It is currently March 28th, 2024, 6:51 pm

Animated gif

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Animated gif

Post by xenium »

balala wrote:
I wrote a code with three ActionTimer plugin measures. Here it is:

Code: Select all

[Rainmeter]
Update=-1

[Variables]
ImageNum=0
U1=[!UpdateMeasure "MeasureSlide1"][!UpdateMeter "MeterImage"][!Redraw]
U2=[!UpdateMeasure "MeasureSlide2"][!UpdateMeter "MeterImage"][!Redraw]
U3=[!UpdateMeasure "MeasureSlide3"][!UpdateMeter "MeterImage"][!Redraw]
Limit1=42
Limit2=136
Limit3=154
Wait=250

[MeasureSlide1]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Up1,#Wait#,#Limit1#
Up1=[!SetVariable ImageNum "(Clamp((#ImageNum#+1),0,#Limit1#))"]#U1#
IfCondition=(#ImageNum#=#Limit1#)
IfTrueAction=[!UpdateMeasure "MeasureSlide2"][!CommandMeasure "MeasureSlide1" "Stop 1"][!CommandMeasure "MeasureSlide2" "Execute 1"]
DynamicVariables=1

[MeasureSlide2]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Up2,#Wait#,#Limit2#+2
Up2=[!SetVariable ImageNum "(Clamp((#ImageNum#+1),#Limit1#,#Limit3#))"]#U2#
IfCondition=(#ImageNum#=#Limit2#+1)
IfTrueAction=[!SetVariable Imagenum "(#Limit1#-1)"][!UpdateMeasure "MeasureSlide2"][!CommandMeasure "MeasureSlide1" "Stop 1"][!CommandMeasure "MeasureSlide2" "Stop 1"][!CommandMeasure "MeasureSlide2" "Execute 1"]
DynamicVariables=1

[MeasureSlide3]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Up2,#Wait#,#Limit3#-#Limit2#+2
Up2=[!SetVariable ImageNum "(Clamp((#ImageNum#+1),#Limit2#,#Limit3#))"]#U3#
IfCondition=(#ImageNum#=#Limit3#)
IfTrueAction=[!CommandMeasure "MeasureSlide3" "Stop 1"]
DynamicVariables=1

[MeterButton1]
Meter=Image
SolidColor=255,0,0
X=0
Y=25
W=30
H=20
LeftMouseUpAction=[!CommandMeasure "MeasureSlide1" "Execute 1"]

[MeterButton2]
Meter=Image
SolidColor=255,240,0
X=10R
Y=0r
W=30
H=20
LeftMouseUpAction=[!SetVariable ImageNum "(#Limit2#-1)"][!UpdateMeasure "MeasureSlide3"][!CommandMeasure "MeasureSlide1" "Stop 1"][!CommandMeasure "MeasureSlide2" "Stop 1"][!CommandMeasure "MeasureSlide3" "Execute 1"]

[MeterImage]
Meter=Image
X=0
Y=10R
ImageName=#@#Frame\Frame#ImageNum#.png
DynamicVariables=1
Note the followings:
  • The Update value of this code is set to -1, which means the skin never updates "by default". Updates are made throught the U1, U2 and respectively U3 variables.
  • If you already have a code, just copy the LeftMouseUpAction options of the [MeterButton1] and [MeterButton2] meters and add them to the appropriate meters in your code. I had to create some meters to can control the skin.
  • See the limits of the whole proces, defined as the Limit1, Limit2 and Limit3 variables in the [Variables] section. I think you can freely modify them.
  • The images are controlled by the value of the ImageNum variable. The code as it is, will work if you have the images placed in the @Resources\Frame folder, their name are Frame and a number from 0 to 154 and their extension is .png. If these conditions aren't met, modify the code appropriately.
Please test this code and let me know if it does what you need.
It's exactly what I want!
The code does the right thing, but there's only one problem:
gif runs now in slow motion and sometimes gets stuck
What's the cause?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animated gif

Post by balala »

xenium wrote:but there's only one problem:
gif runs now in slow motion and sometimes gets stuck
What's the cause?
The cause is that I forgot to reduce the value of the Wait variable, within the [Variables] section. Reduce it. Make a few tries, to get the best value of it.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Animated gif

Post by xenium »

balala wrote:The cause is that I forgot to reduce the value of the Wait variable, within the [Variables] section. Reduce it. Make a few tries, to get the best value of it.
Now it is working ! :17good
Again you did an excellent job! Congratulations!
:welcome: :welcome:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animated gif

Post by balala »

xenium wrote:Now it is working ! :17good
Again you did an excellent job! Congratulations!
:welcome: :welcome:
Thanks for the appreciations. I'm glad if it's working as you wanted.