It is currently March 29th, 2024, 1:27 pm

Syncing skins

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Syncing skins

Post by Yincognito »

jsmorley wrote: March 14th, 2019, 1:58 am Sure, UpdateDivider can be dynamically changed.
Interesting - thanks.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

Post by balala »

qwerky wrote: March 13th, 2019, 6:44 pm So I installed it, and changed the variable to two, as suggested. This caused all five balls to appear, but the three center balls disappeared again when I started it running? (Also, there wasn't any sound.)
Ok, I found the problem. There is a small issue with the TransformationMatrix options of the [MeterLeft2], [MeterCenter] and [MeterRight2] meters. Replace them with the following ones (don1t replace anything else):

Code: Select all

[MeterLeft2]
...
TransformationMatrix=((#Balls#>=1)?(Cos(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)):1);(-(#Balls#>=1)*(Sin(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)));((#Balls#>=1)*Sin(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8));((#Balls#>=1)?(Cos(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)):1);((#Balls#>=1)*(([MeterLeft2:X]+([MeterLeft2:W]/2))-([MeterLeft2:X]+([MeterLeft2:W]/2))*Cos(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)-(0.022*#Width#)*Sin(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)));((#Balls#>=1)*((0.022*#Width#)+([MeterLeft2:X]+([MeterLeft2:W]/2))*Sin(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)-(0.022*#Width#)*Cos(([MeasureTimerLeft]+(#Balls#>=3)*[MeasureTimerRight])*PI/8)))
...

[MeterCenter]
...
TransformationMatrix=((#Balls#>=2)?(Cos(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)):1);(-(#Balls#>=2)*(Sin(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)));((#Balls#>=2)*Sin(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8));((#Balls#>=2)?(Cos(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)):1);((#Balls#>=2)*(([MeterCenter:X]+([MeterCenter:W]/2))-([MeterCenter:X]+([MeterCenter:W]/2))*Cos(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)-(0.022*#Width#)*Sin(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)));((#Balls#>=2)*((0.022*#Width#)+([MeterCenter:X]+([MeterCenter:W]/2))*Sin(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)-(0.022*#Width#)*Cos(([MeasureTimerLeft]+[MeasureTimerRight])*PI/8)))
...

[MeterRight2]
...
TransformationMatrix=((#Balls#>=1)?(Cos(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)):1);(-(#Balls#>=1)*(Sin(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)));((#Balls#>=1)*Sin(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8));((#Balls#>=1)?(Cos(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)):1);((#Balls#>=1)*(([MeterRight2:X]+([MeterRight2:W]/2))-([MeterRight2:X]+([MeterRight2:W]/2))*Cos(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)-(0.022*#Width#)*Sin(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)));((#Balls#>=1)*((0.022*#Width#)+([MeterRight2:X]+([MeterRight2:W]/2))*Sin(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)-(0.022*#Width#)*Cos(([MeasureTimerRight]+(#Balls#>=3)*[MeasureTimerLeft])*PI/8)))
...
I rewrote the first and the fourth elements of all three TransformationMatrix options.
Now I hope it does work well. Does it?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

Post by balala »

qwerky wrote: March 14th, 2019, 12:19 am Okay, unloaded all skins, and loaded Pendulum only. Unfortunately, yes I still see the slight stuttering (occasional double-quick-time-step). Do you see it at all? :confused:
Yeah, there indeed is an occasional slight stuttering. I'm not sure if there is anything to be done, to get rid of it. Probably the skin is set to a too small Update value and there are too many relatively complex calculations to be done (all those TransformationMatrices). Unfortunately no solutions yet.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

Post by balala »

qwerky wrote: March 14th, 2019, 12:23 am Yes, that's exactly right.
Some sort of syncronization can be done, however it's not perfect. But for this, the clock MUST be included into the pendulum skin.
Here is a solution, which uses an ActionTimer plugin measure to move the pendulum. The ActionTimer plugin measure is started when the seconds is changing on the Time measure and is calculated in a way to end up before the next cycle should start. This is an important limitation, because if this doesn't happen, you'll get one error message on every cycle.
This code uses the default Update=1000, because (as I said before) the ActionTimer plugin measure can update the elements of the skin much more frequently then the update set on the skin.
I rewrote your code. Here is what I got:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
skinWidth=274
skinHeight=50
cornerRoundness=7

; pendulumHeight:  height of pendulum skin.
; pendulumBorder:  size of pendulum border.
pendulumHeight=50
pendulumBorder=2

pendulumLEDBorder=1
pendulumLEDSize=5
pendulumSpan=(#skinWidth#-#pendulumBorder#-((#pendulumLEDSize#+#pendulumLEDBorder#+2)*2))
pendulumLEDSpacing=(Trunc(#pendulumSpan#/9))
pendulumStartX=((#skinWidth#-(#pendulumLEDSpacing#*9))/2)

colorPendulumBackground=0,10,36,255
colorPendulumBorder=0,64,192,255
colorPendulumTitleBar=0,64,192,255
;colorLEDBorder=255,255,255,255
colorLEDBorder=0,10,36,255
colorLEDOff=0,10,36,255
colorLEDOn=255,063,063,255
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeasure "msrPendulumWrap"][!UpdateMeterGroup "PendulumLED"][!UpdateMeter "Uptime"][!Redraw]
Num=1
W=38

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Forth,#W#,10 | Wait #W# | Repeat Back,#W#,10
Forth=[!SetVariable Num "(Clamp((#Num#+1),1,10))"]#U#
Back=[!SetVariable Num "(Clamp((#Num#-1),1,10))"]#U#
DynamicVariables=1

[msrPendulumWrap]
Measure=Calc
DynamicVariables=1
Formula=#Num#
IfConditionMode=1
IfCondition=1
IfTrueAction=[!SetOptionGroup PendulumLED PendulumFillColor "Fill Color #*colorLEDOff*#"][!SetOption mtrLED[&msrPendulumWrap] PendulumFillColor "Fill Color #*colorLEDOn*#"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!CommandMeasure "MeasureSlide" "Stop 1"]
;IfAboveValue=9
;IfAboveAction=[!SetOption msrPendulumWrap Formula "msrPendulumWrap-1"]
;IfBelowValue=2
;IfBelowAction=[!SetOption msrPendulumWrap Formula "msrPendulumWrap+1"]

[MeasureTime]
Measure=Time
Format=%#H:%M:%S
OnChangeAction=[!CommandMeasure "MeasureSlide" "Execute 1"]

;[msrPendulumArc1]
;Measure=Calc
;DynamicVariables=1
;Formula=msrPendulumArc+1
;IfConditionMode=1
;ifCondition=1
;IfTrueAction=[!SetVariable PendulumLEDNum "[msrPendulumArc]"]
;IfAboveValue=9
;IfAboveAction=[!SetOption msrPendulumArc Formula "msrPendulumArc-1"]
;IfBelowValue=2
;IfBelowAction=[!SetOption msrPendulumArc Formula "msrPendulumArc+1"]
;
;[msrPendulumArc2]
;Measure=Calc
;DynamicVariables=1
;Formula=Clamp(msrPendulumArc+2,2,21)
;IfConditionMode=1
;ifCondition=1
;IfTrueAction=[!SetVariable PendulumLEDNum "(Clamp(Trunc([msrPendulumArc]/2), 1, 10))"]
;IfAboveValue=20
;IfAboveAction=[!SetOption msrPendulumArc Formula "Clamp(msrPendulumArc-2,2,21)"]
;IfBelowValue=3
;IfBelowAction=[!SetOption msrPendulumArc Formula "Clamp(msrPendulumArc+2,2,21)"]
;
;[msrPendulumSwing]
;Measure=Calc
;DynamicVariables=1
;Formula=1
;IfConditionMode=1
;ifCondition=1
;IfTrueAction=[!SetOptionGroup PendulumLED PendulumFillColor "Fill Color #*colorLEDOff*#"][!SetOption mtrLED#PendulumLEDNum# PendulumFillColor "Fill Color #*colorLEDOn*#"]

[mtrPendulumBackground]
Meter=Shape
Shape=Rectangle 0,0,#skinWidth#,#skinHeight#,#cornerRoundness# | StrokeWidth #pendulumBorder# | Stroke Color #colorPendulumBorder# | Fill Color #colorPendulumBackground#
AntiAlias=1
X=0
Y=0
W=#skinWidth#
H=#skinHeight#

;[mtrArc]
;Meter=Shape
;Shape=Arc 0,0,(#pendulumLEDSpacing#*9),0,41,10,*,1 | StrokeWidth 1 | Stroke Color #colorWhite#
;X=#pendulumStartX#
;Y=10
;DynamicVariables=1

[mtrLED1]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=#pendulumStartX#
Y=10
DynamicVariables=1

[mtrLED2]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#-6)r
Y=26
DynamicVariables=1

[mtrLED3]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+0)r
Y=34
DynamicVariables=1

[mtrLED4]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+3)r
Y=38
DynamicVariables=1

[mtrLED5]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+3)r
Y=40
DynamicVariables=1

[mtrLED6]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=#pendulumLEDSpacing#r
Y=40
DynamicVariables=1

[mtrLED7]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+3)r
Y=38
DynamicVariables=1

[mtrLED8]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+3)r
Y=34
DynamicVariables=1

[mtrLED9]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#+0)r
Y=26
DynamicVariables=1

[mtrLED10]
Meter=Shape
Group=PendulumLED
Shape=Ellipse 0,0,#pendulumLEDSize# | StrokeWidth #pendulumLEDBorder# | Stroke Color #colorLEDBorder# | Extend PendulumFillColor
PendulumFillColor=Fill Color #colorLEDOn#
X=(#pendulumLEDSpacing#-6)r
Y=10
DynamicVariables=1

[MeterTime]
Meter=STRING
MeasureName=MeasureTime
X=(#SkinWidth#/2)
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=Center
AntiAlias=1
Text=%1
Note the newly added [MeasureSlide] and [MeasureTime] Time and Plugin measures, as well as the rewritten [msrPendulumWrap] measure. There also a few variables was added to the [Variables] section (U, Num and W). The most important variable, which you can play with, is W. This sets how often the ActionTimer plugin is updated. And least but not last, there also is a newly added meter, [MeterTime], which shows the time.
You can freely change the format of the [MeasureTime] measure, if needed. Doesn't matter too much how is its Format, the only limitation is that this format has to contain the seconds, too (the %S format code).
You do not have the required permissions to view the files attached to this post.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

Post by qwerky »

jsmorley wrote: March 14th, 2019, 12:35 am I think I might have mentioned that it is really not possible to do this in an entirely reliable way. :-)
Yes, and I've about come to the conclusion that that is correct.

By setting Update=100 (for the pendulum) and DefaultUpdateDivider=9 (instead of 10), and then changing the pendulum back to the first measure (in the previously posted code), I thought it to be a solution. In this case, the pendulum appeared to stay in sync with the clock, and the clock appeared to be free of skipping. It really looked good. But when watching it steadily for an extended period, it turns out that there is still a slight skipping (of one second) that occurs only once every several minutes. So it is much better than before, but still not perfect, alas. :-(
You simply can't synchronize the ticking of the clock, which can only be measured at a granularity of one second, with an animation that by its nature must be measured at a granularity of less than one second, when the animation uses an "approximate" measure of time, and is impacted by other things that Rainmeter is trying to do at the same moment.
So, I'm going to study up on ActionTimer, which you mentioned earlier. Do you see it as possibly being a solution to this issue? If not, I won't bother pursuing the "pendulum problem" any further. :D
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

Post by qwerky »

balala wrote: March 14th, 2019, 6:44 pm Some sort of syncronization can be done, however it's not perfect. But for this, the clock MUST be included into the pendulum skin.
Here is a solution, which uses an ActionTimer plugin measure to move the pendulum.
:D It looks like we were posting at the same time! :Whistle Okay, your attachment looks very good--let me try your code and get back to you. :welcome:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

Post by balala »

qwerky wrote: March 14th, 2019, 6:49 pm Okay, your attachment looks very good--let me try your code and get back to you. :welcome:
Ok, please do so and let me know.
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

Post by qwerky »

balala wrote: March 14th, 2019, 4:55 pm Ok, I found the problem. There is a small issue with the TransformationMatrix options of the [MeterLeft2], [MeterCenter] and [MeterRight2] meters. Replace them with the following ones (don1t replace anything else):

I rewrote the first and the fourth elements of all three TransformationMatrix options.
Now I hope it does work well. Does it?
Yes, it does indeed. Well done. :D

Still no sound, though. And turning shadows on/off in settings, doesn't cause any visible change that I can see. Those are minor points, though. The animation is great, and I think it must have been a great deal of work to get it that way! :great:
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

Post by qwerky »

balala wrote: March 14th, 2019, 6:52 pm Ok, please do so and let me know.
Terrific! :jawdrop I watched it for several minutes, and it appeared that the pendulum stayed in sync with the clock, and that the clock did not skip or stutter at all! 8-) One thing, though. The pendulum is swinging fully right and fully left each second. My original intention was that the pendulum would swing left-to-right in one second, and right-to-left in the next second. Can that be changed?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

Post by balala »

qwerky wrote: March 14th, 2019, 6:57 pm Yes, it does indeed. Well done. :D
Thanks.
qwerky wrote: March 14th, 2019, 6:57 pm Still no sound, though. And turning shadows on/off in settings, doesn't cause any visible change that I can see. Those are minor points, though. The animation is great, and I think it must have been a great deal of work to get it that way! :great:
I'm surprised, because I have both sound and the shadows. The balls have also been disappearing for me too (before have been fixed), but the sound is played and the shadows are there. So:
  • About the sound: have you turned on the speakers (if needed)? (I hope you did). Are other skins playing the sounds?
  • About the shadows: click the clock to hide it. You should have to see the shadows on the horizontal plane of the base (see the attached screenshot). Aren't they there?
You do not have the required permissions to view the files attached to this post.