CMDR_Evolution wrote: ↑March 20th, 2021, 2:34 pm
- The guide mentions a, b, c, d values for stretch / skew for x and y relating to sine and cosine. It says a calculator will be needed for sin and cos. I know calculators have those buttons but I have no idea how to use the meter dimensions to get what's required. Do I just put the pixel numbers in for either x or y, press the sin or cos button, then use that or something else? I Googled it and found loads of trigonometry stuff unrelated to rectangles or how to work out dimensions to be fransformed.
Sorry I'm a little bit late in this discussion, but being about TransformationMatrix, I couldn't resist not to intervene.
I understand you're not too interested in TransformationMatrix anymore, due to what SilverAzide described and he practically is perfectly right, the TransormationMatrix moves only the visual elements of the meter you're applying it to, the clickable area of the meter doesn't change when applying the option. But if in any other case you'd like to apply it anyway, you have to know that you don't have to manually make all those trigonometrical calculations. After all you're sitting in front of a computer, why not to let it to make all calculations for you?
Let's say you want to rotate the meter by 30 degrees, anticlockwise. Theoretically you should calculate Sin30 and Cos30 and use the got values into the TransformationMatrix option. But the Calc measures of Rainmeter have both, trigonometrical functions as well as a function to convert degrees into radians. So instead of calculating manually the Sin and Cos values, you could use for instance the
Sin(Rad(30)) and
(Cos(Rad(30))) functions accordingly.
Let's take a look to an example. In the code below, I defined the rotation angle (30 degrees). The yellow rectangle rotates around its own center. You can see this point as a black dot (created by the [MeterRotCenter] meter). Click the yellow rectangle, in order to rotate it back on to it's not-rotated position (if it's rotated) or rotate it (if it's not):
Code: Select all
[Rainmeter]
Update=-1
SkinWidth=120
SkinHeight=70
BackgroundMode=2
SolidColor=220,220,220,80
[Variables]
Angle=30
[MeterTM]
Meter=Image
X=20
Y=20
W=80
H=30
SolidColor=255,240,0
DynamicVariables=1
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#)))
LeftMouseUpAction=[!SetVariable Angle "(30-#Angle#)"][!UpdateMeter "MeterTM"][!Redraw]
[MeterRotCenter]
Meter=Image
X=([MeterTM:X]+[MeterTM:W]/2-1)
Y=([MeterTM:Y]+[MeterTM:H]/2-1)
W=3
H=3
SolidColor=0,0,0
DynamicVariables=1
If you remove the SkinWidth and SkinHeight options of the [Rainmeter] section, you can see another disadvanteg: in such a case you get the rotated meter cut off. Parts which are going outside of the unrotated meter are cut. To avoid this, you have to set a size for the skin (throught the previously mentioned SkinWidth and SkinHeight options).
As you can see there are ways to get Rainmeter to make the required calculations for you. It's not even too hard, but yes, a little calculation skill is needed.
Since I simply love this powerful option, with all its disadvantages, I'd be happy to help you (or anyone) with it, if needed, anytime later.