It is currently April 16th, 2024, 6:03 am

SolidColor, ClipString and Angle

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: SolidColor, ClipString and Angle

Post by jsmorley »

balala wrote:Yep, but this isn't a very big problem I think, because using the angles with a minus (as I wrote above) changes the rotation direction.
Is it possible to write this so you don't have to force the angle to be the negative of itself?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: SolidColor, ClipString and Angle

Post by jsmorley »

balala wrote: About the TransformationMatrix? If so, I'm not sure if it worth, because the Transformation Matrix Guide in the Tips & Tricks section is very good, I think.
Yike.. That guide is completely incomprehensible for the average user. My thinking was a simple guide to "rotating" a meter, which might be a bit easier to wrap your head around than a really long guide that fully explains the full power of "transforms".
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: SolidColor, ClipString and Angle

Post by eclectic-tech »

balala wrote:

Code: Select all

TransformationMatrix=(cos(Rad(#Angle#)));(-sin(Rad(#Angle#)));(sin(Rad(#Angle#)));(cos(Rad(#Angle#)));(([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*cos(Rad(#Angle#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*sin(Rad(#Angle#)));(([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*sin(Rad(#Angle#))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*cos(Rad(#Angle#)))
If you added this option, you also have to add an Angle variable to the [Variables] section. Obviously this variable represents the rotation angle, in degrees.
Thanks balala!

:17spot2 You should post this separately in "Community Tips" or even "'Featured Tips"! :17spot1

I noticed this code in several other post you made, and used a variation of it to rotate my shape meters.
Because my meter had multiple defined shapes that were not combined, the Rotate and Scale actions of the Shape meter were giving me 'strange' results.
Your code made doing it a simple task! :thumbup:

Thanks for all of your help in applying the power of transformations! :rosegift:
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: SolidColor, ClipString and Angle

Post by balala »

jsmorley wrote:It's possible that the small difference in the X and Y offset that I see with Padding is due to the fact that you are rotating around the center of the meter, which may or may not be equally divisible by 2. If I rotate it around the top left of the meter, that issue seems to go away.
If Padding is applied, that's not true. A small offset appears, even if the meter is rotated around its top left corner. Without Padding there is no offset at all.
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: SolidColor, ClipString and Angle

Post by balala »

eclectic-tech wrote:Thanks balala!

:17spot2 You should post this separately in "Community Tips" or even "'Featured Tips"! :17spot1

I noticed this code in several other post you made, and used a variation of it to rotate my shape meters.
Because my meter had multiple defined shapes that were not combined, the Rotate and Scale actions of the Shape meter were giving me 'strange' results.
Your code made doing it a simple task! :thumbup:

Thanks for all of your help in applying the power of transformations! :rosegift:
I'm glad if you think so.
Note that the formulas used in the TransformationMatrix option are not so complicated, as they seem to be at a first look. The only weirder things are the ([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2) and ([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2) parts of them. These are the coordinates of the anchor point and represents the center of the meter. Otherwise, I just applied what is described in the Transformation Matrix Guide tip.