It is currently April 25th, 2024, 6:45 am

Help: Switching wallpapers with a button

Get help with creating, editing & fixing problems with skins
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

balala wrote: May 12th, 2020, 7:53 pm Depends on what you want to use it for. A Shape meter can easily be modified by Rainmeter code, while an image can't be. On the other hand a shape meter which represents an image can be extremely large, as you saw on the posted link, jsmorley's avatar image created as Shape meter requires 10,000 lines. Way too much.
Yeah I see. That's why designing the image exactly as I need it to be with Photoshop will ease the job. Then Rainmeter will add movement and positionning and actions.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Mino_el_Nukenin wrote: May 12th, 2020, 7:58 pm Yeah I see. That's why designing the image exactly as I need it to be with Photoshop will ease the job. Then Rainmeter will add movement and positionning and actions.
Yep, creating the image through an image manipulation software (such as Photoshop) is definitely easier. But as said, creating a Shape meter has a completely different reason.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 7:22 pm This what I have so far :

Code: Select all

[MeterShapes]
Meter=Shape
Shape=Ellipse 90,90,89 | Fill Color 0,0,0 | StrokeWidth 2 | Stroke Color 255,255,255
Shape2=Arc 14,90,90,14,75,75,360,0,0,0 | StrokeWidth 15 | Stroke Color 255,255,255
AntiAlias=1
I can't manage to have the right fitting for the arc, I want it to be perfectly against the stroke then i'll adapt the depth of it.
Mino_el_Nukenin wrote: May 12th, 2020, 7:46 pmEDIT : Nevermind the shapes and my actual code, I'll design the shapes I need on Photoshop, that's easier.
I strongly disagree - you basically do the same thing in photoshop as in Rainmeter, as you have to create the shape in either program. It's equally "easy" or equally "hard", depending on the shape's complexity.

This code will do the job you want to, although it might need some small adjustments (mainly due to rounding an odd value divided by 2):

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Meters---

[MeterShapes]
Meter=Shape
Shape=Ellipse 90,90,89 | Fill Color 0,0,0 | StrokeWidth 2 | Stroke Color 255,255,255
Shape2=Arc 9,90,90,9,81,81,360,0,0,0 | StrokeWidth 15 | Stroke Color 255,0,0
AntiAlias=1
The reason why your attempt didn't produce the expected results is that strokes are drawn one half outside the shape and one half inside. This is why you have to place the arc at about half the size of the stroke width from the ellipse, in order for them to "touch" each other.

EDIT: Replaced my initial code after making the needed adjustments. Changed the color to better see the result. So in the end, I had to consider both (15/2)px of the arc outside the shape, but also the (2/2)px of the ellipse inside the shape. That amounted for 7.5+1=8.5px to add or subtract to 0 (for StartX and EndY values) and from 89 (for RadiusX and RadiusY values).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 8:21 pm I strongly disagree - you basically do the same thing in photoshop as in Rainmeter, as you have to create the shape in either program. It's equally "easy" or equally "hard", depending on the shape's complexity.
Well yeah, now that I'm designing it on Photoshop you right.
This code will do the job you want to, although it might need some small adjustments (mainly due to rounding an odd value divided by 2):
The reason why your attempt didn't produce the expected results is that strokes are drawn one half outside the shape and one half inside. This is why you have to place the arc at about half the size of the stroke width from the ellipse, in order for them to "touch" each other.
Oh yeah the stroke... I took it into account when creating the circle, but forgot it for the arc.
Now having an arc of a 1/4 of a circle is easy.
The hard part is to have arcs smaller or bigger than circle 1/4 : to find the X and Y that would be on the same radius.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 8:44 pm Well yeah, now that I'm designing it on Photoshop you right.

Oh yeah the stroke... I took it into account when creating the circle, but forgot it for the arc.
Now having an arc of a 1/4 of a circle is easy.
The hard part is to have arcs smaller or bigger than circle 1/4 : to find the X and Y that would be on the same radius.
It's a bit harder, yes. But using sin() and cos() should help in finding out the right values. If you put everything in a formula and use variables, Rainmeter will do the calculations for you, no need to worry about it. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 8:56 pm It's a bit harder, yes. But using sin() and cos() should help in finding out the right values. If you put everything in a formula and use variables, Rainmeter will do the calculations for you, no need to worry about it. ;-)
Yes... I just don't remember at all, all these formulas I used to know back in highschool.. :???: :Whistle
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 9:04 pm Yes... I just don't remember at all, all these formulas I used to know back in highschool.. :???: :Whistle
Maybe this will help in picturing the whole thing:
Image
Multiply the Cos(angle) (for the X) and Sin(angle) (for the Y) by the value of the radius (81 in this case, if I'm not mistaken) and add it to the CenterX and CenterY (90 and 90, i.e. the center of the ellipse) and you're done.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 9:14 pm Maybe this will help in picturing the whole thing:
Image
Multiply the Cos(angle) (for the X) and Sin(angle) (for the Y) by the value of the radius (81 in this case, if I'm not mistaken) and add it to the CenterX and CenterY (90 and 90, i.e. the center of the ellipse) and you're done.
Okay this is reactivating some math memories.
Let's see if I can come up with a formula in Rainmeter.

EDIT : If I create the formula, it will only will be for one shape. But I'll have several shapes... I don't get how it will work for all of them since they will be relative to each others.
Last edited by Mino_el_Nukenin on May 12th, 2020, 9:43 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Mino_el_Nukenin wrote: May 12th, 2020, 9:22 pm Okay this is reactivating some math memories.
Let's see if I can come up with a formula in Rainmeter.
Ok, because I'm already playing with the result of that formula, LOL - and it's really nice. 8-)
Just an advice: try to put things in variables first - it will be much clearer for you (or anybody, for that matter) that way. Then, in the Shape2 option, just devise a formula using the previously created variables.

P.S. I like the created sample so much that I think of adding it into my Rainmeter samples "library". :lol: I just love trigonometry, always did. And that again reminds me of my fu... math teacher from high school, who thought I was no good at it. :x :twisted:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: May 12th, 2020, 9:42 pm Ok, because I'm already playing with the result of that formula, LOL - and it's really nice. 8-)
Just an advice: try to put things in variables first - it will be much clearer for you (or anybody, for that matter) that way. Then, in the Shape2 option, just devise a formula using the previously created variables.

P.S. I like the created sample so much that I think of adding it into my Rainmeter samples "library". :lol: I just love trigonometry, always did. And that again reminds me of my fu... math teacher from high school, who thought I was no good at it. :x :twisted:
Nice !
Just realized how the arc shape works. It's actually expanding in and out of the ellipse line. I thought it was only expanding out of it. I'm so confused now... :o