It is currently June 14th, 2024, 6:27 pm

Animation Question

Get help with creating, editing & fixing problems with skins
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Animation Question

Post by thesurfinsuricate »

Hi!

I would like the animation to start from frame 1 when i move the cursor over the icon.
And then play to frame 18 if i keep the cursor over the icon.
after that i want it to stop from looping even if i keep the cursor over the icon.
(Then if i remove the cursor and bring it back (over the icon) it should start over again.)

I don't want it to keep looping when i hold the mouse over the icon and i don't want the animation to start from different frames.

Is it Possible?
Would be thankful for any tips!


I'm using method two https://docs.rainmeter.net/tips/animated-gif-files/
But instead of Formula=Counter % 18 I'm trying Formula=MeasureAnimation + (MeasureAnimation < 18)

[Rainmeter]
Update=170


[MeasureAnimation]
Measure=Calc
Formula=MeasureAnimation + (MeasureAnimation < 18)


[StaticImage]
Meter=Image
ImageName=#@#Images\ChronoTrigger\ChronoTrigger05.png
H=72
W=72


[MeterAnimation]
Meter=BitMap
MeasureName=MeasureAnimation
BitmapImage=#@#Images\ChronoTrigger\ChronoTrigger06.png
BitmapFrames=18
BitmapExtend=1

[HoverAction]
Meter=Image
ImageName=#@#Images\HoverImage.png
H=72
W=72
MouseOverAction=[!ShowMeter MeterAnimation][!HideMeter StaticImage]
MouseLeaveAction=[!HideMeter MeterAnimation][!ShowMeter StaticImage]
LeftMouseDoubleClickAction=["D:\Bilder"]
User avatar
balala
Rainmeter Sage
Posts: 16304
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation Question

Post by balala »

thesurfinsuricate wrote: April 14th, 2023, 8:21 pm Is it Possible?
It definitely is. Do the followings:
  • If you want the animation to start from frame 1, not 0, the best and simplest solution is to add a new Calc measure to your code, which adds 1 to the value of the [MeasureAnimation] measure. Add the following measure to your code:

    Code: Select all

    [MeasureAnimation2]
    Measure=Calc
    Formula=( MeasureAnimation + 1 )
  • Now you have to disable the [MeasureAnimation] measure, to not get it starting when you refresh or activate the skin. Add a Disabled=1 option to it.
  • Alter the MeasureName option of the [MeterAnimation] measure to MeasureName=MeasureAnimation2, to get the animation relaated to the measure which has the value increased by one, as described above.
  • And finally add the following two options to the "icon" (not sure which meter is this, but I assume it's [MeterAnimation]. If this is not correct, add the options to the meter which you want to use to start or stop the animation):

    Code: Select all

    [MeterAnimation]
    ...
    MouseOverAction=[!EnableMeasure "MeasureAnimation"]
    MouseLeaveAction=[!DisableMeasure "MeasureAnimation"]
User avatar
Yincognito
Rainmeter Sage
Posts: 7428
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Animation Question

Post by Yincognito »

thesurfinsuricate wrote: April 14th, 2023, 8:21 pmI would like the animation to start from frame 1
balala wrote: April 14th, 2023, 8:59 pmIf you want the animation to start from frame 1, not 0
Technically, [MeasureAnimation] will actually start by having an initial value of 1 and not 0 after its update, because the result of the formula in the first update of the measure would be MeasureAnimation + (MeasureAnimation < 18) = 0 + (0 < 18) = 0 + 1 = 1 - you can easily notice this if you set an UpdateDivider=-1 on the measure, for example. Whether that "1" is the desired "frame 1" in the request is open to interpretation, I'm just talking about the measure itself, since that is the reference for the meter.

Sure, by disabling / enabling that measure and adding a [MeasureAnimation2] as above, the animation will start at frame 1 ... but when mouse leaves the area and the measure is disabled, the measure values returns to 0 and 1 instead of staying the same, which might not be what is desired (as far as I understood, frame 1 should be displayed again only on animation restart, when the mouse is again over the area, not when it leaves). Another question is what happens to frame 0 if the animation runs from frame 1 to frame 18, would it still be in the .png, because as far as I can see, it won't ever be used? Lastly, if I'm not missing anything obvious here, if [MeasureAnimation2] runs from 1 to 18, then [MeasureAnimation] should stop at 17, not to mention that BitmapFrames should be 19 to include the assumed frame 0.

Anyway, considering the above, some small changes (I left out the unimportant parts of the code):

Code: Select all

[Rainmeter]
Update=170

[MeasureAnimation]
Disabled=1
Measure=Calc
Formula=MeasureAnimation + (MeasureAnimation < 17)

[MeasureAnimation2]
Measure=Calc
Formula=( MeasureAnimation + 1 )

[MeterAnimation]
Meter=BitMap
MeasureName=MeasureAnimation2
BitmapImage=#@#Images\ChronoTrigger\ChronoTrigger06.png
BitmapFrames=19
BitmapExtend=1
MouseOverAction=[!UnpauseMeasure MeasureAnimation][!DisableMeasure MeasureAnimation][!UpdateMeasure MeasureAnimation][!UpdateMeasure MeasureAnimation2][!EnableMeasure MeasureAnimation]
MouseLeaveAction=[!PauseMeasure MeasureAnimation]
Feel free to disagree or disregard, if my understanding of the request has been faulty.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Re: Animation Question

Post by thesurfinsuricate »

@both balala @Yincognito I'm a rookie at this just so you know.

I want the animation to start at the first picture or maybe at picture 0 if there is such a thing?
What i mean by 'frame 1' is the first picture, before i made this post i used the 'Formula=Counter % 18' winch meant that when i hover over the icon animation looped but the loop could start anywhere from picture 1 to picture 18.

*The 'Formula=Counter % 18* made the animation loop witch i didn't want so i read some other post that mentioned *Formula=MeasureAnimation + (MeasureAnimation < 18)* but that made it so that only one or frame (picture) played.
Yincognito wrote: April 14th, 2023, 10:30 pm I left out the unimportant parts of the code
Does that mean the skin should look like the on your posted aka only consist of:
[Rainmeter]
Update=170

[MeasureAnimation]
Disabled=1
Measure=Calc
Formula=MeasureAnimation + (MeasureAnimation < 17)

[MeasureAnimation2]
Measure=Calc
Formula=( MeasureAnimation + 1 )

[MeterAnimation]
Meter=BitMap
MeasureName=MeasureAnimation2
BitmapImage=#@#Images\ChronoTrigger\ChronoTrigger06.png
BitmapFrames=19
BitmapExtend=1
MouseOverAction=[!UnpauseMeasure MeasureAnimation][!DisableMeasure MeasureAnimation][!UpdateMeasure MeasureAnimation][!UpdateMeasure MeasureAnimation2][!EnableMeasure MeasureAnimation]
MouseLeaveAction=[!PauseMeasure MeasureAnimation]
This seems to make it act as i wanted! The only thing is that the icon moves from left to right and doesn't stay in place!?
Last edited by thesurfinsuricate on April 15th, 2023, 7:22 am, edited 1 time in total.
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Re: Animation Question

Post by thesurfinsuricate »

If i change BitmapFrames=19 to BitmapFrames=18 the icon stays in place!
But the icon doesn't go back to picture 1 when i remove the cursor? :confused:

the static image in my own original post was a separate png of 'frame 1' (picture 1) in the animation.
if the animation can return to animation frame 1 (picture 1) when i remove the cursor would be better..
Last edited by thesurfinsuricate on April 15th, 2023, 7:32 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16304
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation Question

Post by balala »

thesurfinsuricate wrote: April 15th, 2023, 7:11 am I want the animation to start at the first picture or maybe at picture 0 if there is such a thing?
What i mean by 'frame 1' is the first picture, before i made this post i used the 'Formula=Counter % 18' winch meant that when i hover over the icon animation looped but the loop could start anywhere from picture 1 to picture 18.
There is. The first frame is the Frame 0. So the [MeasureAnimation] measure has to start from 0, not from 1. Accordingly the [MeasureAnimation2] is not needed. So what should you do, is to add the Disabled=1 option to the [MeasureAnimation] measure and add the MouseOverAction and MouseLeaveAction options to the [MeterAnimation] meter.
thesurfinsuricate wrote: April 15th, 2023, 7:14 am If i change BitmapFrames=19 to BitmapFrames=18 the icon stays in place!
What value have you to use, depends on the bitmap.
thesurfinsuricate wrote: April 15th, 2023, 7:14 am But the icon doesn't go back to picture 1 when i remove the cursor? :confused:
With the !PauseMeasure and !UnpauseMeasure, the measure is paused not disabled when you're leaving the meter. This means that its value may stop at any value, when you1re leaving the meter, this is why it doesn't jump back to the first frame. If you want it to jump back, use !EnableMeasure and !DiableMeasure bangs in the MouseOverAction and MouseLeaveAction options of the [MeterAnimation] meter.
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Re: Animation Question

Post by thesurfinsuricate »

@balala
[Rainmeter]
Update=160

[MeasureAnimation]
Disabled=1
Measure=Calc
Formula=MeasureAnimation + (MeasureAnimation < 17)

[MeterAnimation]
Meter=BitMap
MeasureName=MeasureAnimation
BitmapImage=#@#Images\ChronoTrigger\ChronoTrigger06.png
BitmapFrames=18
BitmapExtend=1
MouseOverAction=[!EnableMeasure MeasureAnimation]
MouseLeaveAction=[!DiableMeasure MeasureAnimation]
Now the animation wont start when i hover over with cursor?
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Re: Animation Question

Post by thesurfinsuricate »

added [!UpdateMeasure "MeasureAnimation"] here MouseLeaveAction=[!DisableMeasure "MeasureAnimation"][!UpdateMeasure "MeasureAnimation"] that seems to do the trick!
User avatar
Yincognito
Rainmeter Sage
Posts: 7428
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Animation Question

Post by Yincognito »

thesurfinsuricate wrote: April 15th, 2023, 7:11 amThis seems to make it act as i wanted! The only thing is that the icon moves from left to right and doesn't stay in place!?
thesurfinsuricate wrote: April 15th, 2023, 7:14 am If i change BitmapFrames=19 to BitmapFrames=18 the icon stays in place!
But the icon doesn't go back to picture 1 when i remove the cursor? :confused:

the static image in my own original post was a separate png of 'frame 1' (picture 1) in the animation.
if the animation can return to animation frame 1 (picture 1) when i remove the cursor would be better..
The fact that the icon moved and didn't stay in place was because I set the measure to consider 19 and not 18 frames (while your image was still 18 frames), because it wasn't clear what you wanted to do with frame 0 (or whether you talked about 18 frames or more), as the following replies revealed. In the meantime, this has been - somewhat - clarified, I think.

I also - apparently, wrongly this time - assumed that you wanted to restart the animation only when hovering back on the image, and not when leaving it, hence the !PauseMeasure adaptations. In the end, my assumption was incorrect, and you found the way to make it work as you wished - well done! :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
thesurfinsuricate
Posts: 42
Joined: March 20th, 2020, 4:47 pm

Re: Animation Question

Post by thesurfinsuricate »

@balala & @Yincognito thanks for the help!
Yincognito yeah i didn't know frame 0 was picture 1


The pretty bare bone skin if anyone else wants a similar... :great:
Just make a wide png with with the frames (one after another) and place stuff where stuff needs to go!
[Rainmeter]
Update=140

[MeasureAnimation]
Disabled=1
Measure=Calc
Formula=MeasureAnimation + (MeasureAnimation < 4)

[MeterAnimation]
Meter=BitMap
MeasureName=MeasureAnimation
BitmapImage=#@#Images\ChronoTrigger\ChronoTrigger02.png
BitmapFrames=5
BitmapExtend=1
LeftMouseUpAction=["D:\Games""]
MouseOverAction=[!EnableMeasure MeasureAnimation]
MouseLeaveAction=[!DisableMeasure "MeasureAnimation"][!UpdateMeasure "MeasureAnimation"]