It is currently April 23rd, 2024, 10:40 pm

Scaling with TransforamtionMatrix

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Scaling with TransforamtionMatrix

Post by jsmorley »

TransformationMatrix=#Scale#;0;0;#Scale#;((1-#Scale#)*[#CURRENTSECTION#:X]);((1-#Scale#)*[#CURRENTSECTION#:Y])

ScaleImage_1.0.rmskin
GIF.gif

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=430
SkinHeight=430

[Variables]
U=[!UpdateMeasure MeasureScaleIt][!UpdateMeter *][!Redraw]
Scale=1

[MeterTest]
Meter=Image
X=10
Y=10
ImageName=#@#Images\Grr.png
DynamicVariables=1
MouseScrollUpAction=[!CommandMeasure MeasureScaleIt "Execute 1"]
MouseScrollDownAction=[!CommandMeasure MeasureScaleIt "Execute 2"]
TransformationMatrix=#Scale#;0;0;#Scale#;((1-#Scale#)*[#CURRENTSECTION#:X]);((1-#Scale#)*[#CURRENTSECTION#:Y])

[MeasureScaleIt]
Measure=Plugin
Plugin=ActionTimer
ActionList1=ScaleUp
ScaleUp=[!SetVariable Scale "(Clamp(#Scale#+0.05,0.2,2))"]#U#
ActionList2=ScaleDown
ScaleDown=[!SetVariable Scale "(Clamp(#Scale#-0.05,0.2,2))"]#U#
DynamicVariables=1
https://docs.rainmeter.net/manual/meters/general-options/#TransformationMatrix
https://docs.rainmeter.net/tips/transformation-matrix-guide/
https://docs.rainmeter.net/manual/plugins/actiontimer/

Keep in mind that DynamicWindowSize does not react to changes made by TransformationMatrix. So be sure your skin is big enough to hold things you "scale up".
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Scaling with TransforamtionMatrix

Post by jsmorley »

ScaleImage_2.0.rmskin

GIF.gif

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))*2)
SkinHeight=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))*2)

[Variables]
U=[!UpdateMeasure MeasureScaleIt][!UpdateMeter *][!Redraw]
Scale=1
ImageWidth=200
ImageHeight=209

[MeterTest]
Meter=Image
X=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))/2)
Y=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))/2)
ImageName=#@#Images\Grr.png
DynamicVariables=1
MouseScrollUpAction=[!CommandMeasure MeasureScaleIt "Execute 1"]
MouseScrollDownAction=[!CommandMeasure MeasureScaleIt "Execute 2"]
TransformationMatrix=#Scale#;0;0;#Scale#;((1-#Scale#)*([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2));((1-#Scale#)*([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2))

[MeasureScaleIt]
Measure=Plugin
Plugin=ActionTimer
ActionList1=ScaleUp
ScaleUp=[!SetVariable Scale "(Clamp(#Scale#+0.05,0.2,2))"]#U#
ActionList2=ScaleDown
ScaleDown=[!SetVariable Scale "(Clamp(#Scale#-0.05,0.2,2))"]#U#
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.