Skip to content

Instantly share code, notes, and snippets.

@reisir
Created July 27, 2023 19:41
Show Gist options
  • Save reisir/2c8762397881f05ee0079a70f0bd1979 to your computer and use it in GitHub Desktop.
Save reisir/2c8762397881f05ee0079a70f0bd1979 to your computer and use it in GitHub Desktop.
Arc RoundLine (round progress)
; Arc that follows an ellipse shape. Basically a replacement for the RoundLine meter.
; Arcs can use the various Stroke modifiers that come with the Shape meter.
; Could also be used to make any meter follow an ellipse shape
[Rainmeter]
Update=16
; Source measure. Should have MinValue / MaxValue set if not automatically provided by the measure
[MeasureProgress]
Measure=Loop
StartValue=0
EndValue=1000
[Variables]
; Arc size
Width=200
Height=200
; Arc style
StrokeWidth=25
Background=150,150,150
Stroke=255,255,255
; Arc settings. Angles in degrees. Toggles as 0 | 1
StartAngle=180
RotationAngle=360
ClockWise=1
Spin=1
; Transform the source to 0-1 for easier use
[decimal]
Measure=Calc
Formula=([MeasureProgress:%] / 100)
DynamicVariables=1
; Arc positions on the ellipse. Measured in rotations (0.5 = 180 deg)
; Breaks if start > end || start < 0 || end < 0
[start]
Measure=Calc
Formula=0
[end]
Measure=Calc
Formula=(decimal * #RotationAngle# / 360)
; Offset the "cycle" of the arc. Basically rotates it along the ellipse.
[offset]
Measure=Calc
Formula=(#Spin# = 1) ? decimal : 0
; The radiuses can be made dynamic if you want to animate the size of the ellipse
[RX]
Measure=Calc
Formula=#Width# / 2
UpdateDivider=-1
[RY]
Measure=Calc
Formula=#Height# / 2
UpdateDivider=-1
; Get the direction multiplier
[Direction]
Measure=Calc
Formula=#ClockWise# = 1 ? -1 : 1
UpdateDivider=-1
; Arc cordinates
[X1]
Measure=Calc
Formula=RX + RX * Sin((start + offset) * Pi * 2 * Direction + Rad(#StartAngle#))
[Y1]
Measure=Calc
Formula=RY + RY * Cos((start + offset) * Pi * 2 * Direction + Rad(#StartAngle#))
[X2]
Measure=Calc
Formula=RX + RX * Sin((end + offset) * Pi * 2 * Direction + Rad(#StartAngle#))
[Y2]
Measure=Calc
Formula=RY + RY * Cos((end + offset) * Pi * 2 * Direction + Rad(#StartAngle#))
; Arc shape options
[SweepDirection]
Measure=Calc
Formula=#ClockWise# = 1 ? 0 : 1
UpdateDivider=-1
[ArcSize]
Measure=Calc
Formula=((end - start) <= 0.5) ? 0 : 1
[Shape]
Meter=Shape
Shape=Ellipse ([RX]), ([RY]), ([RX]), ([RY]) | Extend Stroke | Fill Color 0,0,0,0 | Stroke Color #Background#
Shape2=Arc ([X1]), ([Y1]), ([X2]), ([Y2]),([RX]),([RY]),*,[SweepDirection],[ArcSize] | Extend Stroke
Stroke=StrokeWidth #StrokeWidth# | Stroke Color #Stroke# | StrokeEndCap Round | StrokeStartCap Round
X=(#StrokeWidth# / 2) + 1
Y=(#StrokeWidth# / 2) + 1
DynamicVariables=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment