EDIT: I have created a very long and very detailed explanation of exactly what is going on. If you wish to dive in and try to help me solve this, click here. Thanks!
Hello everyone. I am attempting to create a sky dial using shape meters, and while I have done a basic one before, the one I am currently creating is very complicated and convoluted. I am creating this thread because I am bound to have many math-related issues with path shapes.
Here is my first problem:
For the moon icon, I would like to be able to display the current moon phase, as well as the angle of the illuminated side as you would see it in the sky. I have done both of these things before, that is not my problem. My problem arises when I attempt to implement them on the sky dial:
That's not right at all!
My only hypothesis so far is that when the moon limb shape (the white illuminated part) is at certain angles, it's changing where the top-left of the limb's bounding box is, and therefore, the arc rotation anchor point moves as well. However, I have absolutely no clue how to fix it. I need to somehow create a function of the moon's limb rotation that will move the arc rotation anchor back to where it is supposed to be (signified by the green dot).
Does anybody have any ideas? Much appreciated.
AstroDial.ini:
Code: Select all
[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
[Variables]
; Colors
colorBg=15,15,15
colorDialArc=150,150,150
colorMoon=200,200,200
colorMoonBg=30,30,30
colorMoonBorder=70,70,70
colorSun=250,222,110
; Dial settings
dialRadius=250
dialStartX=3
dialArcThickness=6
dialObjectRadius=23
; Moon settings
moonBorderThickness=3
moonInnerRadius=(#dialObjectRadius# - #moonBorderThickness#)
moonArcStartX=(#dialStartX# - #dialObjectRadius#)
moonArcStartY=(#dialRadius# - #moonBorderThickness#)
; =========================
; DEBUG TESTING VARIABLES
; =========================
; Sun / Moon Angles on the Dial (degrees)
sunDialAngle=-1
moonDialAngle=0
; Angle that the illuminated limb of the moon will face (degrees, starts North, counterclockwise)
moonViewAngle=0
; If set to 1, the moon will orient based on the value above. If set to 0, waxing will display on the right, and waning will display on the left.
showMoonAngle=1
; Moon phase value: 0.0 (new) -> 0.5 (full) -> 1.0 (new)
moonPhase=0.12
; ==================================================
; MEASURES
; ==================================================
[MeasureSunDialVisibility]
Measure=Calc
Formula=#sunDialAngle#
IfCondition=(MeasureSunDialVisibility > 180) || (MeasureSunDialVisibility < 0)
IfTrueAction=[!SetVariable sunDialVisibility 0][!UpdateMeter MeterAstroDial][!Redraw]
IfFalseAction=[!SetVariable sunDialVisibility 255][!UpdateMeter MeterAstroDial][!Redraw]
DynamicVariables=1
[MeasureMoonDialVisibility]
Measure=Calc
Formula=#moonDialAngle#
IfCondition=(MeasureMoonDialVisibility > 180) || (MeasureMoonDialVisibility < 0)
IfTrueAction=[!SetVariable moonDialVisibility 0][!UpdateMeter MeterAstroDial][!Redraw]
IfFalseAction=[!SetVariable moonDialVisibility 255][!UpdateMeter MeterAstroDial][!Redraw]
DynamicVariables=1
; Converts the moon phase value into a radius value usable by the arc shape
[MeasureMoonShapePhaseCalc]
Measure=Calc
Formula=clamp(abs((#moonInnerRadius# * 4 * ((#moonPhase# > 0.5) ? (0.5 - (#moonPhase# - 0.5)) : #moonPhase#)) - #moonInnerRadius#),0,#moonInnerRadius#)
DynamicVariables=1
; TEMPORARY DEBUG
[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Increase, 16, 180
ActionList2=ResetMove | Repeat Move, 16, 180
ActionList3=ResetMove | Repeat Both, 16, 180
Increase=[!SetVariable moonViewAngle "(#moonViewAngle# + 2)"][!UpdateMeter MeterAstroDial][!UpdateMeasure MeasureActionTimer][!Redraw]
Move=[!SetVariable moonDialAngle "(#moonDialAngle# + 1)"][!UpdateMeter MeterAstroDial][!UpdateMeasure MeasureActionTimer][!Redraw]
Both=[!SetVariable moonViewAngle "(#moonViewAngle# + 2)"][!SetVariable moonDialAngle "(#moonDialAngle# + 1)"][!UpdateMeter MeterAstroDial][!UpdateMeasure MeasureActionTimer][!Redraw]
ResetMove=[!SetVariable moonDialAngle 0][!UpdateMeter MeterAstroDial][!UpdateMeasure MeasureActionTimer][!Redraw]
DynamicVariables=1
; ==================================================
; METERS
; ==================================================
[MeterAstroDial]
Meter=Shape
; Arc
Shape=Arc #dialStartX#,#dialRadius#,(#dialRadius# * 2 + #dialStartX#),#dialRadius#,#dialRadius#,#dialRadius# | StrokeWidth #dialArcThickness# | Stroke Color #colorDialArc# | StrokeStartCap Round | StrokeEndCap Round
; Sun
Shape2=Ellipse #dialStartX#,#dialRadius#,#dialObjectRadius#,#dialObjectRadius# | StrokeWidth 0 | Fill Color #colorSun#,#sunDialVisibility# | Rotate #sunDialAngle#,(#dialRadius# + #dialObjectRadius#),(#dialObjectRadius#)
; Moon
Shape3=Ellipse #dialStartX#,#dialRadius#,#dialObjectRadius#,#dialObjectRadius# | StrokeWidth 0 | Fill Color #colorMoonBorder#,#moonDialVisibility# | Rotate #moonDialAngle#,(#dialRadius# + #dialObjectRadius#),(#dialObjectRadius#)
Shape4=Ellipse #dialStartX#,#dialRadius#,#moonInnerRadius#,#moonInnerRadius# | StrokeWidth 0 | Fill Color #colorMoonBg#,#moonDialVisibility# | Rotate #moonDialAngle#,(#dialRadius# + #moonInnerRadius#),(#moonInnerRadius#)
Shape5=Ellipse #dialStartX#,#dialRadius#,#moonInnerRadius#,#moonInnerRadius# | StrokeWidth 0 | Fill Color #colorMoon#,#moonDialVisibility#
Shape6=Path MoonArc | StrokeWidth 0 | Fill Color #colorMoon# | Rotate (((#showMoonAngle# = 1) ? (-#moonViewAngle#) : ((#moonPhase# > 0.5) ? -90 : 90)) - #moonDialAngle#),#moonInnerRadius#,#moonInnerRadius# | Offset #moonBorderThickness#,#moonBorderThickness# | StrokeLineJoin Round
MoonArc=#moonArcStartX#,#moonArcStartY# | ArcTo (#moonArcStartX# + (#moonInnerRadius# * 2)),#moonArcStartY#,#moonInnerRadius#,[MeasureMoonShapePhaseCalc:],0,(((#moonPhase# > 0.25) && (#moonPhase# < 0.75)) ? 1 : 0) | ArcTo #moonArcStartX#,#moonArcStartY#,#moonInnerRadius#,#moonInnerRadius#,0,1
Shape7=Combine Shape5 | Intersect Shape6 | Rotate #moonDialAngle#,(#dialRadius# + #moonInnerRadius#),(#moonInnerRadius#)
Shape8=Ellipse #dialRadius#,#dialRadius#,5,5 | StrokeWidth 0 | Fill Color 0,150,0
Padding=30,30,30,30
SolidColor=#colorBg#
DynamicVariables=1
[MeterDebugLimbRotation]
Meter=String
FontFace=Arial
FontSize=12
FontColor=230,230,230
Padding=5,5,5,5
SolidColor=#colorBg#
Y=R
Text=Debug Limb Rotation
LeftMouseUpAction=[!CommandMeasure MeasureActionTimer "Execute 1"]
Antialias=1
[MeterDebugDialRotation]
Meter=String
FontFace=Arial
FontSize=12
FontColor=230,230,230
Padding=5,5,5,5
SolidColor=#colorBg#
Y=R
Text=Debug Dial Rotation
LeftMouseUpAction=[!CommandMeasure MeasureActionTimer "Execute 2"]
Antialias=1
[MeterDebugBoth]
Meter=String
FontFace=Arial
FontSize=12
FontColor=230,230,230
Padding=5,5,5,5
SolidColor=#colorBg#
Y=R
Text=Debug Both Rotations
LeftMouseUpAction=[!CommandMeasure MeasureActionTimer "Execute 3"]
Antialias=1
Code: Select all
[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
[Variables]
; Moon phase value: 0.0 (new) -> 0.5 (full) -> 1.0 (new)
moonPhase=0.0
; Angle that the illuminated limb of the moon will be displayed at (starting at north, going clockwise)
moonViewAngle=0
; Set to 1 to use moonViewAngle, 0 to display horizontally
showMoonAngle=0
; Internal moon variables
moonRadius=16
moonBorderThickness=2
moonInnerRadius=(#moonRadius# - #moonBorderThickness#)
; Colors
colorBg=15,15,15
colorMoon=200,200,200
colorMoonBg=30,30,30
colorMoonBorder=70,70,70
; Converts the moon phase value into a radius value usable by the arc shape
[MeasureMoonShapePhaseCalc]
Measure=Calc
Formula=clamp(abs((#moonInnerRadius# * 4 * ((#moonPhase# > 0.5) ? (0.5 - (#moonPhase# - 0.5)) : #moonPhase#)) - #moonInnerRadius#),0,#moonInnerRadius#)
DynamicVariables=1
[MeterMoonShape]
Meter=Shape
Shape=Ellipse #moonRadius#,#moonRadius#,#moonRadius#,#moonRadius# | StrokeWidth 0 | Fill Color #colorMoonBorder#
Shape2=Ellipse #moonRadius#,#moonRadius#,#moonInnerRadius#,#moonInnerRadius# | StrokeWidth 0 | Fill Color #colorMoonBg#
Shape3=Path MoonArc | StrokeWidth 0 | Fill Color #colorMoon# | Rotate ((#showMoonAngle# = 1) ? (-#moonViewAngle# + 180) : ((#moonPhase# > 0.5) ? -90 : 90)),#moonInnerRadius#,#moonInnerRadius# | Offset #moonBorderThickness#,#moonBorderThickness# | StrokeLineJoin Round
MoonArc=0,#moonInnerRadius# | ArcTo (#moonInnerRadius# * 2),#moonInnerRadius#,#moonInnerRadius#,[MeasureMoonShapePhaseCalc:],0,(((#moonPhase# > 0.25) && (#moonPhase# < 0.75)) ? 1 : 0) | ArcTo 0,#moonInnerRadius#,#moonInnerRadius#,#moonInnerRadius#,0,1
Padding=10,10,10,10
SolidColor=#colorBg#
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureMoonShapeActionTimer "Execute 1"]
; Temporary measure for debug purposes - animates between new moon and full moon, then back
[MeasureMoonShapeActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Increase, 16, 100 | Wait 1000 | Repeat Increase, 16, 100 | Reset
Increase=[!SetVariable moonPhase "(#moonPhase# + 0.005)"][!UpdateMeasure MeasureMoonShapePhaseCalc][!UpdateMeter MeterMoonShape][!UpdateMeasure MeasureMoonShapeActionTimer][!Redraw]
Reset=[!SetVariable moonPhase 0][!UpdateMeasure MeasureMoonShapePhaseCalc][!UpdateMeter MeterMoonShape][!UpdateMeasure MeasureMoonShapeActionTimer][!Redraw]
DynamicVariables=1