It is currently April 18th, 2024, 10:35 pm

[reloaded] I am struggling with RoundLine

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

[reloaded] I am struggling with RoundLine

Post by Mor3bane »

Hi all,

The goal: Make a RoundLine Hour circle that starts at a variable time and concludes at another variable time.

What I think I need to do: Make a RoundLine Meter that has a "zero" position and it draws in an arc until the "end" position reletive to an actual clock's hours.

How to do it?: I can draw a circle, size it, position it, but not much after that.

I cannot seem to get my head around all of the different parameters - without a basic working meter to start from - basic would be managing the start and end positions effectively/accurately.

I will keep tacking away, and hopefully someone might be able to get me rolling in the right direction in the mean time.
Last edited by Mor3bane on August 20th, 2018, 10:03 am, edited 2 times in total.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: For some reason I am struggling with RoundLine

Post by FreeRaider »

Perhaps some thing like this can help you: https://forum.rainmeter.net/viewtopic.php?p=122296#p122296
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: For some reason I am struggling with RoundLine

Post by Mor3bane »

Thanks @ FreeRaider

I'll check it out. Looks to be fairly close to what I'm going for.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: For some reason I am struggling with RoundLine

Post by Mor3bane »

So, I made some "progress".

However, I am having trouble achieving my actual goal :-
To get the roundline "sundial" to begin and end at the correct 24 hour clock positions for sunup and sundown.

Here's what I have managed so far;

(You may recognise the sun up/set skin I grabbed the base from a recent post by von__zeppelin)

Code: Select all

[Rainmeter]
Update=1000
Author=Morbane
Group=Big

[Metadata]
Description=Displays the position of the sun.

[Variables]
FontFace="Astronaut"
FontColor=23,153,140
ProgressCir=85,215,202
LocationCode=ASXX0079
Units=c
Width=182
Height=90
Xorigin=25
Yorigin=70
WebParserSunRiseSet=<sunr>(.*):(.*) (.*)</sunr>.*<suns>(.*):(.*) (.*)</suns>

[MeasureParent]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
URL=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#Units#&dayf=1
RegExp="(?siU)#WebParserSunRiseSet#"
Debug=2

[MeterBack]
Meter=Image
ImageName=#@#Background.png
X=5
Y=48

;===== MeasureSunrise/set ======;
[MeasureAstronomySunriseHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1

[MeasureAstronomySunriseMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=2

[MeasureAstronomySunriseAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=3
Substitute="AM":"0","PM":"1"

[MeasureAstronomySunsetHour]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=4

[MeasureAstronomySunsetMin]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=5

[MeasureAstronomySunsetAMPM]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=6
Substitute="AM":"0","PM":"1"

;===== MeasurePosition =========;
[MeasureAstronomySunriseHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunriseAMPM]*12+MeasureAstronomySunriseHour
Percentual=1
DynamicVariables=1

[MeasureAstronomySunsetHourAdjust]
Measure=Calc
Formula=[MeasureAstronomySunsetAMPM]*12+MeasureAstronomySunsetHour
Percentual=1
DynamicVariables=1

[MeasureDifferenceinMin]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust*60+MeasureAstronomySunsetMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin)

[MeasureCurrentHour]
Measure=Time
Format=%H

[MeasureCurrentMin]
Measure=Time
Format=%M

[MeasurePosition1]
Measure=Calc
Formula=((MeasureCurrentHour*60+MeasureCurrentMin)-(MeasureAstronomySunriseHourAdjust*60+MeasureAstronomySunriseMin))/MeasureDifferenceinMin

[MeasurePosition2]
Measure=Calc
Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1)

[MeasureX]
Measure=Calc
Formula=#Xorigin#+0.5*#Width#*(1-cos(pi*MeasurePosition2))

[MeasureY]
Measure=Calc
Formula=#Yorigin#+#Height#*(1-sin(pi*MeasurePosition2))

;===== Meters ==================;
[MeterSunTrail]
Meter=Image
ImageName=#@#SunTrail.png
ImageAlpha=217
W=250
H=150
X=10
Y=50

[MeterSunIcon]
Meter=Image
ImageName=#@#Sun.png
ImageAlpha=217
W=35
H=35
X=[MeasureX]
Y=[MeasureY]
DynamicVariables=1

[MeterAstronomySunrise]
Meter=String
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=13
AntiAlias=1
ClipString=1
StringAlign=Left
MeasureName=MeasureAstronomySunriseHourAdjust
MeasureName2=MeasureAstronomySunriseMin
W=75
H=20
X=32
Y=190
Text=%1:%2

[MeterAstronomySunset]
Meter=String
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=13
AntiAlias=1
ClipString=1
StringAlign=Right
MeasureName=MeasureAstronomySunsetHourAdjust
MeasureName2=MeasureAstronomySunsetMin
W=75
H=20
X=205r
Y=r
Text=%1:%2

[MeterText]
Meter=String
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=20
AntiAlias=1
StringAlign=Center
Text="Sun PosiTion"
X=(#CURRENTCONFIGWIDTH#/2 + 2)
Y=210
DynamicVariables=1

;===== Measure Sundial ======;
[MeterSundial]
Meter=RoundLine
X=135
Y=150
LineLength=20
LineStart=18
LineColor=#FontColor#
Solid=1
Antialias=1

[MeasureTimeUp]
Measure=Calc
Formula=(MeasureAstronomySunriseHourAdjust * 60 + MeasureAstronomySunriseMin) / (23 * 60 + 59)

[MeterSunUp]
Meter=Roundline
MeasureName=MeasureTimeUp
X=135
Y=150
LineLength=20
LineStart=18
StartAngle=4.7123889
RotationAngle=6.2831853
LineColor=#ProgressCir#
Solid=1

[MeasureTimeDown]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust * 60 + MeasureAstronomySunsetMin) / (23 * 60 + 59)

[MeterSunDown]
Meter=Roundline
MeasureName=MeasureTimeDown
X=135
Y=150
LineLength=20
LineStart=18
StartAngle=4.7123889
RotationAngle=6.2831853
LineColor=#ProgressCir#
Solid=1
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: For some reason I am struggling with RoundLine

Post by Mor3bane »

I modified these and without knowing in advance "exactly" if this is working so far, here are the edits:-

Code: Select all

[MeasureTimeUp]
Measure=Calc
Formula=(MeasureAstronomySunriseHourAdjust * 60 + MeasureAstronomySunriseMin) / (23 * 60 + 59)
Percentual=1

[MeterSunUp]
Meter=Roundline
MeasureName=MeasureTimeUp
X=135
Y=150
LineLength=20
LineStart=18
StartAngle=0.00
RotationAngle=6.2831853
LineColor=#ProgressCir#
Solid=1
AntiAlias=1

[MeasureTimeDown]
Measure=Calc
Formula=(MeasureAstronomySunsetHourAdjust * 60 + MeasureAstronomySunsetMin) / (23 * 60 + 59)
Percentual=1

[MeterSunDown]
Meter=Roundline
MeasureName=MeasureTimeDown
X=135
Y=150
LineLength=20
LineStart=18
StartAngle=4.7123889
RotationAngle=6.2831853
ValueRemainder=86400
LineColor=#ProgressCir#
Solid=1
AntiAlias=1
Seems ok but on a 24 hour increment the change will not be immediately apparent - to me at least.

The ideal outcome would be for the MeterSunUp and MeterSunDown to be a complete single arc, however this looks like it progresses until the MeterSunDown reaches it's 100% value of the actual sunset time.(?)
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: For some reason I am struggling with RoundLine

Post by FreeRaider »

Out of curiosity, do you want something like this one ?
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: For some reason I am struggling with RoundLine

Post by Mor3bane »

FreeRaider wrote:Out of curiosity, do you want something like this one ?
That is what I am modifying - I am adding a "sundial" to it - or trying to anyway.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: For some reason I am struggling with RoundLine

Post by eclectic-tech »

So, if I understand, you want a 2 pixel wide, 20 pixel diameter radius circle, that shows when the sun is up/down in relation to your 24 Clock, which has midnight at the bottom center?

First you need to set the startangle at the offset to your 'zero' position (bottom center to match your 24 hour clock), so that would be (Rad(90)). Then add to that, the time of sunrise using the value of the sunrise hour times 15 (each hour of a 24 hour clock is 15 degrees) + the sunrise minutes times 0.25 (each minute is 1/4 of a degree) to set the starting point at sunrise.

Then in your measure to drive the roundline, use the difference between sunset hours times 60 plus the sunset minutes and the sunrise hours times 60 + the sunrise minutes, and divided that by the total minutes in a day (1440) to get a percentage.

You do not need to calculate the sundown, since it is the remaining percentage value of sunup.

So to display, use a roundline, solid filled circle, the same size as the sunup meter to start (this will represent the sun down time) and overlay the sunup roundline.

Code: Select all

[MeterSundial]
Meter=RoundLine
X=135
Y=150
LineStart=10
LineColor=#FontColor#
Solid=1
Antialias=1

[MeasureTimeUp]
Measure=Calc
Formula=((MeasureAstronomySunsetHourAdjust * 60 + MeasureAstronomySunsetMin)-(MeasureAstronomySunriseHour * 60 + MeasureAstronomySunriseMin)) / 1440

[MeterSunUp]
Meter=Roundline
MeasureName=MeasureTimeUp
X=135
Y=150
LineLength=20
LineStart=10
StartAngle=(Rad(90+([MeasureAstronomySunriseHour] * 15) + ([MeasureAstronomySunriseMin] * 0.25)))
RotationAngle=(Rad(360))
LineColor=#ProgressCir#
Solid=1
DynamicVariables=1
I used a 10 pixel wide arc to show the settings...
sundial1.png
This will match the times on your 24 hour clock.

If you had something else in mind, let us know...
You do not have the required permissions to view the files attached to this post.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: For some reason I am struggling with RoundLine

Post by Mor3bane »

eclectic-tech - thanks a ton

Now that I see the math, it makes all the sense in the world

Never was too slick in maths.

I was actually aiming at a 12 oclock at the top dial so as to appear more natural

However, the sundial idea kind of grew in different ways - to possibly function like one rather than using the name

Anyway, here is the end product -
Image

So it is obvious that I was modifying someone's work, but you can see what I meant by "functioning like a sundial" by having the shadow be relative to the position of the sun in the meter - but I am contented with the result as I originally imagined it.

Thanks again eclectic-tech :thumbup:
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [Solved] I am struggling with RoundLine

Post by eclectic-tech »

Glad to help.

To have midnight at the top center, replace '90' in the StartAngle value calculation with '270'. The default starting point (Rad(0)) is at the 3 o'clock position, so just add (or subtract) the degrees to start where you want.

Nice edit on the skins! :great: