Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 776

Featured Guides • Working with Angle on a String Meter (redux)

$
0
0
As you can see, this will make positioning a bit tricky, as while X works fine, the center of rotation is also based on where Y (the top) is defined for the meter, and there is really no way to have the anchor be actually in the vertical "middle" of the text string.
Well, since I (thought that I) needed it in one of my codes, here is the way - it's actually quite simple if you draw things on a piece of paper:

Code:

[Rainmeter]Update=100AccurateText=1DynamicWindowSize=1[MeasureRotate]Measure=CalcFormula=(MeasureRotate % 360) + 10[MeterBack]Meter=ImageW=100H=100SolidColor=47,47,47,255[MeterOne]Meter=StringX=50Y=50StringAlign=CenterCenterFontSize=12FontColor=0,0,0,0SolidColor=255,150,150,128AntiAlias=1Text=Hello World[MeterTwo]Meter=StringX=(50+[MeterTwo:W]*0.5*0+[MeterTwo:H]*0.5*Cos(Rad([MeasureRotate]-90)))Y=(50+[MeterTwo:H]*0.5*1+[MeterTwo:H]*0.5*Sin(Rad([MeasureRotate]-90)))StringAlign=CenterCenterFontSize=12FontColor=255,255,255,255SolidColor=150,150,150,128AntiAlias=1Text=Hello WorldAngle=(Rad([MeasureRotate]))DynamicVariables=1
Desktop_2024_08_17_21_08_16_340-ezgif.com-optimize.gif
Some parts of the X and Y formulas can be canceled, of course - I let them like that so that every one of them is clear. This seems to work without requiring changes for most if not all string alignments. Didn't test other fonts, but I reckon the 0.5 factor of [MeterTwo:H] will have to be adjusted for fonts where the text is higher or lower than the absolute middle in the meter area. White is the adjusted meter area, red is the reference meter area.

Statistics: Posted by Yincognito — Today, 6:14 pm — Replies 30 — Views 44062



Viewing all articles
Browse latest Browse all 776

Trending Articles