It is currently March 28th, 2024, 9:19 pm

help rotating image

Get help with creating, editing & fixing problems with skins
kόlasi
Posts: 1
Joined: February 7th, 2018, 1:23 pm

help rotating image

Post by kόlasi »

This isn't my code and i'm not really good with rainmeter but i was hoping someone could help me get this image to rotate

Code: Select all

[RainMeter]

Update = 1



[Variables]

Color = 251,255,255

Alpha = 255



[Bar]

BitMapImage = #@#\Bars.png

ImageTint = #Color#, #Alpha#
BitMapFrames = 41

BitmapZeroFrame = 1

AntiAlias = 1



[Meter]

Meter = Image
W = 440

H = 440

SolidColor = 0, 0, 0, 1

@Include1 = #@#\Measure Audio.inc
@include2 = #@#\Bars.inc
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: help rotating image

Post by jsmorley »

Can you attach the image so I can look at it?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: help rotating image

Post by balala »

Same way as jsmorley and dvo said, I'm not sure what would you like to rotate. The [Meter] image meter? If so, there is no need of an image, because that meter uses just SolidColor, so you can simply rotate it, eg using a TransformationMatrix option. Add the following option to the [Meter] meter (without removing or modifying the existing options):

Code: Select all

[Meter]
...
TransformationMatrix=(Cos(Rad(#Angle#)));(-Sin(Rad(#Angle#)));(Sin(Rad(#Angle#)));(Cos(Rad(#Angle#)));(#CenterX#+[Meter:X]-(#CenterX#+[Meter:X])*Cos(Rad(#Angle#))-(#CenterY#+[Meter:Y])*Sin(Rad(#Angle#)));(#CenterY#+[Meter:Y]+(#CenterX#+[Meter:X])*Sin(Rad(#Angle#))-(#CenterY#+[Meter:Y])*Cos(Rad(#Angle#)))
DynamicVariables=1
This TransformationMatrix also requires the DyanmicVariables=1 option, also posted above. It works if you define the following variables in the [Variables] section of the skin:
  • Angle is the rotation angle, in degrees. Note that positive value rotates the image anticlockwise, while a negative value rotates it clockwise.
  • CenterX and CenterY are the coordinates of the center of rotation, relatively to the image (very important). This means that if you want to rotate the image around its own center, you have to set the two variable to CenterX=220 and CenterY=220, because the size of the image is W=440 and H=440. Dividing these values by 2, you get the mentioned coordinates for the center of rotation.
Please let me know if this meats your needs and if it doesn't, what have I mistaken.