It is currently March 29th, 2024, 11:51 am

Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

Mor3bane wrote: August 25th, 2020, 6:11 pm If we were talking rather than typing, I think I could have done better describing things - my brain and the keyboard function at two different speeds and things get lost in translation from brain to fingers lol. Sometimes I try too hard to simplify things so as not to be too verbose, perhaps verbosity is better than repetition. Well, not perhaps, most certainly so.

In the future I will not spare the ink, so to speak.

I will share the final version once ive got it all pretty and such. :)
Yeah, me I try too hard to properly explain things and become too verbose, so it's the opposite. :lol: I understand what you mean - I make efforts to be more compact in what I write, but probably fail most of the times... :confused:

I'll probably work on my own version as well, when I'm in the mood for it - I'd like to see how it works with parsed values and / or Time measures. The required adjustments would probably be minor since as long as the bare hours, minutes and seconds values are extracted it should behave exactly as the current code, but still I have to check it.

By the way, I know you said you didn't care for size and such, but the coordinates of the Rotators can be modified like:

Code: Select all

X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
in order for the rotator images to contain only the icons of the sun or moon. As it is now, they contain the whole skin extent in terms of W and H, and for very large W and H it would probably have some impact on the CPU - thus reducing the meters' size to only the needed parts wouldn't be a bad idea.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
pbutler6
Posts: 100
Joined: April 27th, 2020, 8:10 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by pbutler6 »

Yincognito -- Thank you son much.

I have the Roundline arcs and Rotator images working with my Skin. The images for Sun & Moon are a real improvement.

Is there a way to have a container for the sun and moon images? I tried the following, but it doesn't work:

Code: Select all

[ContainerSun]
Meter=Shape
Shape=Rectangle (#size#*0),(#size#*0),(#size#*40),(#size#*40),(#size#*70)
DynamicVariables=1

[Sun]
Meter=Rotator
MeasureName=SinceSunrise
ImageName=#@#Sun.png
Container=ContainerSun
X=390+#Radius#
Y=170+#Radius#
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-#Radius#+#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

pbutler6 wrote: August 26th, 2020, 7:26 pm Yincognito -- Thank you son much.

I have the Roundline arcs and Rotator images working with my Skin. The images for Sun & Moon are a real improvement.

Is there a way to have a container for the sun and moon images? I tried the following, but it doesn't work:

Code: Select all

[ContainerSun]
Meter=Shape
Shape=Rectangle (#size#*0),(#size#*0),(#size#*40),(#size#*40),(#size#*70)
DynamicVariables=1

[Sun]
Meter=Rotator
MeasureName=SinceSunrise
ImageName=#@#Sun.png
Container=ContainerSun
X=390+#Radius#
Y=170+#Radius#
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-#Radius#+#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
I'm not sure why you'd want a disk-like container for the sun and moon images, I mean ... it's not like they will get out of their orbit, right (assuming X=#Radius# and Y=#Radius# for [Sun], that is)? When first seeing your reply I thought you wanted a container to hide the sun and moon movement on their 'down' arc, basically trying to simulate how a sun / moon rise would look like in real life - but then saw that it was a disk and hence my confusion as to what purpose could it have.

Anyway, to answer your question, yes, it's possible, but you have to remember that the coordinates of the meters in a container are relative to the container coordinates, so, if by any chance you kept the #Radius# and #ImageW# values of 90 and 32 from my posted code, it might be that the 390 and 170 values you add in the X and Y options of [Sun] are too large, and the sun's orbit is entirely "out of view" because of the container masking things.

Bear in mind that I have no idea what you're trying to accomplish, so I can't tailor the dimensions or positions to achieve such a thing, but for me, assuming Radius=90, SizeW=32 and size=5.3, adding just 30 to #Radius# in the X and Y options of [Sun] works. It might not be exactly what you want, but it will give you an idea where things are positioned and what to do to place and size them properly.

P.S. Other than that, I made my code work with the forecasted sun and moon rise times from the weather.com's JSON, and kept the animation to test how it looks. As expected and mentioned already, there is this small "jump" of the moon when the data for the following day is applied, but that's just because I didn't bother to "choose" the right moonset and just went straight for the moonset from the same day as the moonrise (even though that moonset may "belong" to, say, the moonrise of the previous day). I guess that's up for each skin designer to make his choice regarding how he choses the moonset, and I'll probably have to tweak that aspect later on, but the bottom line is that it works great otherwise. Avoiding or greatly alleviating the "jump" (which is happening just once per day when the day changes anyway, so no tragedy) is purely a matter of choosing the right moonset when parsing, that's all. After that the "jump" will become more or less as insignificant as the sun's (which is undetectabe with the naked eye, as it's only a couple of minutes difference in rise and set times from day to day).
Last edited by Yincognito on August 26th, 2020, 10:19 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

--- Deleted post, mistaken edit with replying, LOL ---
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
pbutler6
Posts: 100
Joined: April 27th, 2020, 8:10 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by pbutler6 »

I have an image of the moon that changes with the phase. Unfortunately, the image has a black square background. If I can have a container at the end of the rotator arm that is a circle for the right size of the image I want to show, then I can mask the black background and just show the image of the moon.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

pbutler6 wrote: August 26th, 2020, 11:11 pm I have an image of the moon that changes with the phase. Unfortunately, the image has a black square background. If I can have a container at the end of the rotator arm that is a circle for the right size of the image I want to show, then I can mask the black background and just show the image of the moon.
It would be much simpler to just edit the image and remove the black background (Magic Eraser in Photoshop does it with a single click, if the background color is the same all over). The way you try to do it now is going to be more complicated than just putting a container there: you have to use an image for the container, because it will rotate as a Rotator at the same time as the contained meter, you'd probably have to make not so simple modifications to the coordinates as well to cover the relative positioning to the container, etc.

Or, you can search for a similar image online - hopefully having a transparent background this time.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
pbutler6
Posts: 100
Joined: April 27th, 2020, 8:10 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by pbutler6 »

Because the moon displays the phase only the Full Moon is a circle. Every day is a little different. The New Moon is almost the same color as the background, so removing the background eliminates virtually all of the image and the arc and desktop background (or the skin solid color) shows through. The displayed image needs to be an opaque circle.

I was hoping to be able to have a disc-shaped container at the end of the rotator arm so that only the moon would show through the container and the background would not show through the moon. I see what you mean when you say that the image would need to be rotated with reference to the arm so that hte image remains upright. The rotations would need to be proportional to the [SinceMoonRise] variable. As the rotator rotates clockwise, the image needs to rotate counter-clockwise. I think that I the image would need to rotate whether or not I had a container.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by SilverAzide »

pbutler6 wrote: August 27th, 2020, 2:29 am Because the moon displays the phase only the Full Moon is a circle. Every day is a little different. The New Moon is almost the same color as the background, so removing the background eliminates virtually all of the image and the arc and desktop background (or the skin solid color) shows through. The displayed image needs to be an opaque circle.
Yincognito is right, you need a transparent background. I'm not sure what image you are going for, but I already did all the work of a photo-realistic moon image with a transparent background, where the dark parts are opaque. Grab the Gadgets suite here and download the rmskin. There are 29 moon images in the @Resources\WxIcons folder, representing every day, taken from actual photos. The dark parts were added by layering a dimmed image of the full moon in Photoshop.

P.S.: There's no dark side of the moon, really. As a matter of fact, it's all dark.
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

SilverAzide wrote: August 27th, 2020, 2:53 am Yincognito is right, you need a transparent background. I'm not sure what image you are going for, but I already did all the work of a photo-realistic moon image with a transparent background, where the dark parts are opaque. Grab the Gadgets suite here and download the rmskin. There are 29 moon images in the @Resources\WxIcons folder, representing every day, taken from actual photos. The dark parts were added by layering a dimmed image of the full moon in Photoshop.

P.S.: There's no dark side of the moon, really. As a matter of fact, it's all dark.
Thanks, SilverAzide, I was actually going to offer the same (?) icons to pbutler6 and suggest the same thing. I have mine in the same file though - but obviously I got them from you as well. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

pbutler6 wrote: August 27th, 2020, 2:29 am Because the moon displays the phase only the Full Moon is a circle. Every day is a little different. The New Moon is almost the same color as the background, so removing the background eliminates virtually all of the image and the arc and desktop background (or the skin solid color) shows through. The displayed image needs to be an opaque circle.

I was hoping to be able to have a disc-shaped container at the end of the rotator arm so that only the moon would show through the container and the background would not show through the moon. I see what you mean when you say that the image would need to be rotated with reference to the arm so that hte image remains upright. The rotations would need to be proportional to the [SinceMoonRise] variable. As the rotator rotates clockwise, the image needs to rotate counter-clockwise. I think that I the image would need to rotate whether or not I had a container.
I understand, but I disagree that the image would have to be rotated in the opposite direction as the container - they would both rotate clockwise. Anyway, SilverAzide was kind enough to provide you with a solution (one that I was going to provide as well) which simplifies things. As for removing the black background without removing the "black" new moon image, you could apply a trick to make it happen - just draw a circle around the moon (you can even create a path, add a stroke on it, or even better, select using the Elliptical Marquee, followed by inverting the selection), remove the background, then remove the circle the same way. Sure, there would be some pixels that would be left there as their color would be "between other colors" from and RGB point of view, but those can be removed as well, using either Select / Modify / Feather when it comes to selection or Layer / Matting / Defringe when it comes to pixels - at least that's what I recall.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth