It is currently April 18th, 2024, 6:01 am
Rotational + scaling transformation matrix
-
- Posts: 104
- Joined: June 7th, 2021, 11:46 am
Rotational + scaling transformation matrix
Hello! I am currently trying to create an animation by rotating an image around it's center. There is a guide from the docs, but it seems to use the rotator meter and the image size cannot be dynamically changed. Is there a way to do this with transformation matrix on a image meter? Thanks
-
- Rainmeter Sage
- Posts: 5391
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Rotational + scaling transformation matrix
Yes, you can do this using an image meter (you can resize the image using W & H) and add a TransformationMatrix to the image meter.
Code: Select all
[Rainmeter]
Update=250
SkinWidth=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))+(#XOffset#*0.5))
SkinHeight=((SQRT((#ImageWidth#**2)+(#ImageHeight#**2)))+(#YOffset#*0.5))
[Variables]
ImageWidth=160
ImageHeight=160
XOffset=40
YOffset=40
RotationCenterX=(#ImageWidth#*0.5+#XOffset#)
RotationCenterY=(#ImageHeight#*0.5+#YOffset#)
Angle=[loop1]
[Loop1]
Measure=Loop
StartValue=0
EndValue=345
Increment=15
LoopCount=0
InvertMeasure=0
[Image]
Meter=Image
X=#XOffset#
Y=#YOffset#
W=#ImageWidth#
H=#ImageHeight#
SolidColor=247,47,47,200
AntiAlias=1
DynamicVariables=1
TransformationMatrix=(Cos(Rad(#Angle#)));(-Sin(Rad(#Angle#)));(Sin(Rad(#Angle#)));(Cos(Rad(#Angle#)));(#RotationCenterX#-#RotationCenterX#*Cos(Rad(#Angle#))-#RotationCenterY#*Sin(Rad(#Angle#)));(#RotationCenterY#+#RotationCenterX#*Sin(Rad(#Angle#))-#RotationCenterY#*Cos(Rad(#Angle#)))
You do not have the required permissions to view the files attached to this post.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rotational + scaling transformation matrix
It can be, using the same TransformationMatrix. If eclectic-tech's solution doesn't meat your needs and you would like to see how such a TransformationMatrix can be used to resize a Rotator meter, please let me know.
-
- Posts: 104
- Joined: June 7th, 2021, 11:46 am
Re: Rotational + scaling transformation matrix
Thanks eclectic-tech for your solution! This helped me out a lot
Rotator meter's flexibility for me is a bit low, so I won't be using that. Thanks for the offer though balala
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rotational + scaling transformation matrix
As you wish. You're welcome.
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Rotational + scaling transformation matrix
I am really a noob at tm.
So, isn't tm relative to meter position?
from the Realm of Death
-
- Rainmeter Sage
- Posts: 5391
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Rotational + scaling transformation matrix
I'm no expert on TM either. but the answer to your question is 'yes', it is relative to 1 fixed point in the meter defined by Tx and Ty values. By default it is the upper left corner.death.crafter wrote: ↑August 28th, 2021, 9:58 am I am really a noob at tm.
So, isn't tm relative to meter position?
Have a look at these TM examples: https://forum.rainmeter.net/viewtopic.php?f=119&t=29750&p=153848&hilit=scaling#p153841 they scale from the upper left corner or from the center point.
Correction: Balala is right, the TM is relative to 0,0 position in the SKIN (in configs with only 1 meter, that is the same point).
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 2602
- Joined: March 23rd, 2015, 5:26 pm
Re: Rotational + scaling transformation matrix
Ack! I wish I would have seen that TM post 4 years ago! It should be pinned at the top of the forum, if not for the examples then for the Invader Zim reference.eclectic-tech wrote: ↑August 28th, 2021, 1:54 pm I'm no expert on TM either. but the answer to your question is 'yes', it is relative to 1 fixed point in the meter defined by Tx and Ty values. By default it is the upper left corner.
Have a look at these TM examples: https://forum.rainmeter.net/viewtopic.php?f=119&t=29750&p=153848&hilit=scaling#p153841 they scale from the upper left corner or from the center point.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rotational + scaling transformation matrix
Actually not:
See the What the heck is Rainmeter doing?! section of the Transformation Matrix Guide.Every transformation you do will always be relative to the origin. That's the point with coordinates (0,0).