Aethaerx wrote: ↑March 29th, 2021, 6:53 pm
- I'm trying to add a START ANIMATION that only runs once the skin is loaded and that is it. I have created a folder with all the .png files and added code to the .ini file but the animation plays in a loop. How do I get it to only play once at launch.
Replace the [ImageNumberCalc] measure with the following one:
Code: Select all
[ImageNumberCalc]
Measure=Calc
Formula=( ImageNumberCalc + 1 )
IfCondition=(#CURRENTSECTION#>=153)
IfTrueAction=[!PauseMeasure "#CURRENTSECTION#"]
Note the value I used on the IfCondition option (153). If needed replace it with the appropriate value. I supposed there are 154 frames, counted by 0 to 153, that's why I added 153 here. If there are more or less frames, modify the value accordingly.
Aethaerx wrote: ↑March 29th, 2021, 6:53 pm
- I'm trying to add a start up sound that goes along with the animation as well. I have created a folder with the .wav file but I'm unsure how to add the sound properly so that it plays only once and only when the skin is loaded (so along with the animation.) I have added the SoundFile to the variables section but am unsure where to go from there.
There are more possibilities. I probably would add the following OnRefreshAction option to the [Rainmeter] section:
OnRefreshAction=[Play "#SoundFile#"]. This option is executed only once, when you activate / refresh the skin.
Aethaerx wrote: ↑March 29th, 2021, 6:53 pm
- Say I have a second animation and this animation I want to start in a continuous loop after the person clicks a button and only stops if the person clicks the same button again. Is that possible? I'm assuming that would be a MouseUp/Down action of some sort?
Add a NumFrames2ndAnim variable to the [Variables] section, in which you store the number of frames of the second animation (for instance I added this to the [Variables] section:
NumFrames2ndAnim=50, supposing there are 50 frames in the second animation).
Add the following measure to the code:
Code: Select all
[MeasureSecondAnimation]
Measure=Calc
Formula=(( MeasureSecondAnimation + 1 ) % #NumFrames2ndAnim# )
Paused=1
Use the above measure into the new (second) animation. For example the second animation will look this way:
Code: Select all
[ImageMeterOf2ndAnimation]
Meter=Image
ImageName=#@#Images\Launch\LoadingImage-[MeasureSecondAnimation].png
X=0r
Y=10R
AntiAlias=1
DynamicVariables=1
Don't forget to adjust the value of the NumFrames2ndAnim variable and the values of the above X and Y option. I used arbitrary values.
Finally use the following LeftMouseUpAction option on the button (which can be an Image meter, or a Button meter, but in this second case, you can replace the LeftMousrupAction option with a ButtonCommand option; see the differences between them
here):
LeftMouseUpAction=[!TogglePauseMeasure "MeasureSecondAnimation"].
With the above solution, you get this second animation paused on the refresh / activation of skin, get it started on click and get it paused on the next click. The pause happens immediately when you click, no matter where the animation is. If needed, the above code can be modified ina way to get the pause only when the animation reaches the last frame. Is it needed?
Aethaerx wrote: ↑March 29th, 2021, 6:53 pm
- Finally, say I want an animated button so when the user hovers their mouse over a static image button it turns into a blinking, animated button for as long as the MouseHover is there. Then upon clicking on the button it performs an action. Is that possible as well?
Yep, it definitely is, but in this case the button must be an Image meter (see the above description, about the possibility to use a Button meter instead).
For instance add the following new measure to the code:
Code: Select all
[MeasureBlinking]
Measure=Calc
Formula=(( MeasureBlinking + 1 ) % 2 )
Disabled=1
UpdateDivider=10
Note the
UpdateDivider=10 option, which I added to get one update of the measure per second (corelated with the
Update=100 option, used into the [Rainmeter] section).
Add the following options to the button:
Code: Select all
[MeterButton]
...
ImageAlpha=(1+254*(1-[MeasureBlinking]))
...
MouseOverAction=[!EnableMeasure "MeasureBlinking"]
MouseLeaveAction=[!DisableMeasure "MeasureBlinking"]
DynamicVariables=1