xenium wrote:these are the images:
There are four times the same pair of images. Right?
Here is my first attempt. Usually a such skin should have a very small Update value set in the [Rainmeter] section, to can have an acceptable rotation speed. Instead of this solution, I chosen another one: I've set the Update to -1 (which means the skin is never updated) and have used the very great ActionTimer plugin, which for such cases is very useful.
I chosen to rotate the images with TransformationMatrix options. I admit, it's not too easy, but it has a few advantages (at least in my opinion). Here you have a very good description of how it does work:
https://docs.rainmeter.net/tips/transformation-matrix-guide/
First you have to know I've used two images: Off.png and On.png, accordingly. I placed both, in the @Resources folder. If you want to have them anywhere else, just modify the OffBulb and OnBulb variables, within the [Variables] section. When you load the skin, four bulbs are visible, all turned off. If you click the first one, it starts rotating, at 180 degrees stops, turns on, then continues rotating. When it finishes a whole rotation, the skin waits a number of seconds equal with the value of Wait variable (you can modify this variable to get a longer or shorter waiting), then the second bulb starts rotating. Then so on, until the last one finishes a complete rotation. In this moment all bulbs turn off. If you click again the first bulb, the whole process restarts. I know this is a bit different from what you've asked, but I just wanted to make the skin to can restart the whole process, even without a refresh. If you don't like this way, please let me know to can modify the code accordingly.
And finally, here is the code. Please let me know if it does what you'd like.
Code: Select all
[Rainmeter]
Update=-1
AccurateText=1
DynamicWindowSize=1
[Variables]
Rot1=0
Rot2=0
Rot3=0
Rot4=0
W=0
Wait=5
U1=[!UpdateMeasure "MeasureRotate1"][!UpdateMeasure "MeasureBulb1"][!UpdateMeter "MeterBulb1"][!Redraw]
U2=[!UpdateMeasure "MeasureRotate2"][!UpdateMeasure "MeasureBulb2"][!UpdateMeter "MeterBulb2"][!Redraw]
U3=[!UpdateMeasure "MeasureRotate3"][!UpdateMeasure "MeasureBulb3"][!UpdateMeter "MeterBulb3"][!Redraw]
U4=[!UpdateMeasure "MeasureRotate4"][!UpdateMeasure "MeasureBulb4"][!UpdateMeter "MeterBulb4"][!Redraw]
OffBulb=#@#Off.png
OnBulb=#@#On.png
;[MeasureRotate1]
;Measure=Calc
;Formula=( MeasureRotate1 + 5 )
;IfCondition=(#CURRENTSECTION#=180)
;IfTrueAction=[!PauseMeasure "#CURRENTSECTION#"]
[MeasureRotate1]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat On,10,360
On=[!SetVariable Rot1 "(Clamp((#Rot1#+1),0,360))"][!EnableMeasure "MeasureBulb1"]#U1#
ActionList2=Repeat Wait,1000,#Wait#
Wait=[!SetVariable W "(Clamp((#W#+1),0,#Wait#))"]#U1#
IfCondition=(#W#=#Wait#)
IfTrueAction=[!SetVariable W "0"][!CommandMeasure "MeasureRotate1" "Execute 1"][!CommandMeasure "MeasureRotate1" "Stop 2"]#U1#
DynamicVariables=1
[MeasureRotate2]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat On,10,360
On=[!SetVariable Rot2 "(Clamp((#Rot2#+1),0,360))"][!EnableMeasure "MeasureBulb2"]#U2#
ActionList2=Repeat Wait,1000,#Wait#
Wait=[!SetVariable W "(Clamp((#W#+1),0,#Wait#))"]#U2#
IfCondition=(#W#=#Wait#)
IfTrueAction=[!SetVariable W "0"][!CommandMeasure "MeasureRotate2" "Execute 1"][!CommandMeasure "MeasureRotate2" "Stop 2"]#U2#
DynamicVariables=1
[MeasureRotate3]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat On,10,360
On=[!SetVariable Rot3 "(Clamp((#Rot3#+1),0,360))"][!EnableMeasure "MeasureBulb3"]#U3#
ActionList2=Repeat Wait,1000,#Wait#
Wait=[!SetVariable W "(Clamp((#W#+1),0,#Wait#))"]#U3#
IfCondition=(#W#=#Wait#)
IfTrueAction=[!SetVariable W "0"][!CommandMeasure "MeasureRotate3" "Execute 1"][!CommandMeasure "MeasureRotate3" "Stop 2"]#U3#
DynamicVariables=1
[MeasureRotate4]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat On,10,360
On=[!SetVariable Rot4 "(Clamp((#Rot4#+1),0,360))"][!EnableMeasure "MeasureBulb4"]#U4#
ActionList2=Repeat Wait,1000,#Wait#
Wait=[!SetVariable W "(Clamp((#W#+1),0,#Wait#))"]#U4#
IfCondition=(#W#=#Wait#)
IfTrueAction=[!SetVariable W "0"][!CommandMeasure "MeasureRotate4" "Execute 1"][!CommandMeasure "MeasureRotate4" "Stop 2"]#U4#
DynamicVariables=1
[MeasureBulb1]
Measure=Calc
Formula=#Rot1#
IfCondition=(#CURRENTSECTION#=180)
IfTrueAction=[!CommandMeasure "MeasureRotate1" "Stop 1"][!CommandMeasure "MeasureRotate1" "Execute 2"][!SetOption MeterBulb1 ImageName "#OnBulb#"]#U1#
IfCondition2=(#CURRENTSECTION#=360)
IfTrueAction2=[!CommandMeasure "MeasureRotate1" "Stop 1"][!CommandMeasure "MeasureRotate2" "Execute 1"][!UpdateMeter "MeterBulb1"][!Redraw]
DynamicVariables=1
Disabled=1
[MeasureBulb2]
Measure=Calc
Formula=#Rot2#
IfCondition=(#CURRENTSECTION#=180)
IfTrueAction=[!CommandMeasure "MeasureRotate2" "Stop 1"][!CommandMeasure "MeasureRotate2" "Execute 2"][!SetOption MeterBulb2 ImageName "#OnBulb#"]#U2#
IfCondition2=(#CURRENTSECTION#=360)
IfTrueAction2=[!CommandMeasure "MeasureRotate2" "Stop 1"][!CommandMeasure "MeasureRotate3" "Execute 1"][!UpdateMeter "MeterBulb2"][!Redraw]
DynamicVariables=1
Disabled=1
[MeasureBulb3]
Measure=Calc
Formula=#Rot3#
IfCondition=(#CURRENTSECTION#=180)
IfTrueAction=[!CommandMeasure "MeasureRotate3" "Stop 1"][!CommandMeasure "MeasureRotate3" "Execute 2"][!SetOption MeterBulb3 ImageName "#OnBulb#"]#U3#
IfCondition2=(#CURRENTSECTION#=360)
IfTrueAction2=[!CommandMeasure "MeasureRotate3" "Stop 1"][!CommandMeasure "MeasureRotate4" "Execute 1"][!UpdateMeter "MeterBulb3"][!Redraw]
DynamicVariables=1
Disabled=1
[MeasureBulb4]
Measure=Calc
Formula=#Rot4#
IfCondition=(#CURRENTSECTION#=180)
IfTrueAction=[!CommandMeasure "MeasureRotate4" "Stop 1"][!CommandMeasure "MeasureRotate4" "Execute 2"][!SetOption MeterBulb4 ImageName "#OnBulb#"]#U4#
IfCondition2=(#CURRENTSECTION#=360)
IfTrueAction2=[!CommandMeasure "MeasureRotate4" "Stop 1"][!SetOption MeterBulb1 ImageName "#OffBulb#"][!SetOption MeterBulb2 ImageName "#OffBulb#"][!SetOption MeterBulb3 ImageName "#OffBulb#"][!SetOption MeterBulb4 ImageName "#OffBulb#"][!SetVariable Rot1 "0"][!SetVariable Rot2 "0"][!SetVariable Rot3 "0"][!SetVariable Rot4 "0"][!UpdateMeter "MeterBulb1"][!UpdateMeter "MeterBulb2"][!UpdateMeter "MeterBulb3"][!UpdateMeter "MeterBulb4"]#U1##U2##U3##U4#
DynamicVariables=1
Disabled=1
[MeterBulb1]
Meter=Image
ImageName=#OffBulb#
X=150
Y=20
TransformationMatrix=(Cos(Rad(#Rot1#)));(-Sin(Rad(#Rot1#)));(Sin(Rad(#Rot1#)));(Cos(Rad(#Rot1#)));(([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos(Rad(#Rot1#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin(Rad(#Rot1#)));(([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin(Rad(#Rot1#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos(Rad(#Rot1#)))
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure "MeasureRotate1" "Execute 1"]
[MeterBulb2]
Meter=Image
ImageName=#OffBulb#
X=90r
Y=0r
TransformationMatrix=(Cos(Rad(#Rot2#)));(-Sin(Rad(#Rot2#)));(Sin(Rad(#Rot2#)));(Cos(Rad(#Rot2#)));(([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos(Rad(#Rot2#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin(Rad(#Rot2#)));(([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin(Rad(#Rot2#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos(Rad(#Rot2#)))
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure "MeasureRotate2" "Execute 1"]
[MeterBulb3]
Meter=Image
ImageName=#OffBulb#
X=90r
Y=0r
TransformationMatrix=(Cos(Rad(#Rot3#)));(-Sin(Rad(#Rot3#)));(Sin(Rad(#Rot3#)));(Cos(Rad(#Rot3#)));(([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos(Rad(#Rot3#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin(Rad(#Rot3#)));(([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin(Rad(#Rot3#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos(Rad(#Rot3#)))
DynamicVariables=1
[MeterBulb4]
Meter=Image
ImageName=#OffBulb#
X=90r
Y=0r
TransformationMatrix=(Cos(Rad(#Rot4#)));(-Sin(Rad(#Rot4#)));(Sin(Rad(#Rot4#)));(Cos(Rad(#Rot4#)));(([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos(Rad(#Rot4#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin(Rad(#Rot4#)));(([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin(Rad(#Rot4#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos(Rad(#Rot4#)))
DynamicVariables=1