It is currently April 20th, 2024, 5:17 am

Help using Dynamic Variables to change skin size...

Get help with creating, editing & fixing problems with skins
User avatar
Falconer
Posts: 115
Joined: August 12th, 2009, 4:10 pm
Location: Behind you!

Help using Dynamic Variables to change skin size...

Post by Falconer »

For practice, I put together a clock skin where changing one variable scaled the entire skin. (Using lots of little calc measures as dynamic variables). Incredibly, that works just fine. Change one variable to any number between 1 and 10, and the skin scales accordingly. I was pretty happy. :D

The trouble came up when I started trying to use Mouse Actions to change the size of the skin when you clicked on it, like so:

Code: Select all

MiddleMouseDownAction=!RainmeterSetVariable Scale (#Scale#+0.1)
MiddleMouseDoubleClickAction=!RainmeterSetVariable Scale (#Scale#-0.1)
Incredibly, that also works just fine, except that when you Middle click the skin and it gets bigger, the "area" does not change and part of the skin gets cut off:

Before Click: :)
Image

After Click: :(
Image

This does not happen when you change the variable manually, only when you use the !bang to change the variable, which I find most puzzling. I have two different meters that have dynamic variable width and height lines, to keep pieces from getting cut off, put it happened anyway when I use the bang to scale the skin.

Help? :?

Full Code:

Code: Select all

[Variables]
;Font="M+ 2C"
Scale=1.5
Font=DejaVu Sans
Backing=0,0,0,1
Highlight=255,255,255,180
Hands=200,200,200,180

;########## Measures ##########

[MeasureTimeHands]
Measure=Time

[MeasureTimeNum]
Measure=Time
Format=%I:%M

[MeasureAlways1]
Measure=FreeDiskSpace
Drive=C:
Total=1
MaxValue=1
MinValue=0
UpdateDivider=86400

;Scaling measures for every component:

[CenterStart]
Measure=Calc
Formula=#Scale#*9
DynamicVariables=1

[CenterEnd]
Measure=Calc
Formula=#Scale#*11
DynamicVariables=1

[OrbitStart]
Measure=Calc
Formula=#Scale#*48
DynamicVariables=1

[OrbitEnd]
Measure=Calc
Formula=#Scale#*50
DynamicVariables=1

[HourStart]
Measure=Calc
Formula=#Scale#*31
DynamicVariables=1

[MinuteStart]
Measure=Calc
Formula=#Scale#*21
DynamicVariables=1

[SecondStart]
Measure=Calc
Formula=#Scale#*11
DynamicVariables=1

[HandEnd]
Measure=Calc
Formula=#Scale#*48
DynamicVariables=1

[HandWidth]
Measure=Calc
Formula=#Scale#*2
DynamicVariables=1

[TextSize]
Measure=Calc
Formula=#Scale#*9
DynamicVariables=1

[TextX]
Measure=Calc
Formula=([OrbitEnd]-[CenterStart])
DynamicVariables=1

[TextY]
Measure=Calc
Formula=([OrbitEnd]-((0.6)*[TextSize]))
DynamicVariables=1

[SkinSize]
Measure=Calc
Formula=[OrbitEnd]*2
DynamicVariables=1

;########## Meters ##########
;Pieces

[MeterFrame]
Meter=IMAGE
X=0
Y=0
W=[SkinSize]
H=[SkinSize]
SolidColor=0,0,0,1
DynamicVariables=1
MiddleMouseDownAction=!RainmeterSetVariable Scale (#Scale#+0.1)
MiddleMouseDoubleClickAction=!RainmeterSetVariable Scale (#Scale#-0.1)

[MeterBackingOne]
MeasureName=MeasureAlways1
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=5
LineStart=0
LineLength=[CenterStart]
LineColor=#Backing#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterBackingTwo]
MeasureName=MeasureAlways1
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=5
LineStart=[CenterEnd]
LineLength=[OrbitStart]
LineColor=#Backing#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterCenter]
MeasureName=MeasureAlways1
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=5
LineStart=[CenterStart]
LineLength=[CenterEnd]
LineColor=#Highlight#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterOrbit]
MeasureName=MeasureAlways1
Meter=ROUNDLINE
X=0
Y=0
W=[SkinSize]
H=[SkinSize]
StartAngle=4.712
RotationAngle=6.283
LineWidth=5
LineStart=[OrbitStart]
LineLength=[OrbitEnd]
LineColor=#Highlight#
Solid=1
AntiAlias=1
DynamicVariables=1

;Hands

[HourHand]
MeasureName=MeasureTimeHands
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=[HandWidth]
LineStart=[HourStart]
LineLength=[HandEnd]
LineColor=#Hands#
ValueRemainder=43200
Solid=0
AntiAlias=1
DynamicVariables=1

[MinuteHand]
MeasureName=MeasureTimeHands
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=[HandWidth]
LineStart=[MinuteStart]
LineLength=[HandEnd]
LineColor=#Hands#
ValueRemainder=3600
Solid=0
AntiAlias=1
DynamicVariables=1

[SecondHand]
MeasureName=MeasureTimeHands
Meter=ROUNDLINE
X=[OrbitEnd]
Y=[OrbitEnd]
StartAngle=4.712
RotationAngle=6.283
LineWidth=[HandWidth]
LineStart=[SecondStart]
LineLength=[HandEnd]
LineColor=#Hands#
ValueRemainder=60
Solid=0
AntiAlias=1
DynamicVariables=1

[TimeText]
MeasureName=MeasureTimeNum
Meter=String
X=[TextX]
Y=[TextY]
FontFace=#Font#
FontSize=[TextSize]
FontColor=#Highlight#
StringAlign=RIGHT
StringStyle=NORMAL
AntiAlias=1
DynamicVariables=1
Last edited by Falconer on November 9th, 2010, 12:43 am, edited 1 time in total.
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Help using Dynamic Variables to change skin size...

Post by Alex2539 »

Add this to the top of your skin:

Code: Select all

[Rainmeter]
DynamicWindowSize=1
The problem was that when a skin is loaded, it creates a "window" for it that is the exact size of the entire skin. If the skin leaves that window, it gets cut off. By adding DynamicWindowSize=1 you tell Rainmeter to adjust the size of the window when the skin gets too big.

Also, kudos on getting that skin to work! It's pretty good! :thumbsu:
ImageImageImageImage
User avatar
Falconer
Posts: 115
Joined: August 12th, 2009, 4:10 pm
Location: Behind you!

Re: Help using Dynamic Variables to change skin size...

Post by Falconer »

Awesome! Works like a charm now. Thanks for the help! :D

And thank you; I'm not really happy with the aesthetics of the skin yet,
but I'm pretty excited that it works.
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Help using Dynamic Variables to change skin size...

Post by Chewtoy »

Another solution would be to use !RainmeterWriteKeyValue and !RainmeterRefresh.
The window will then be redrawn. Not really smoother, but a solution none the less.
I don't think, therefore I'm not.