It is currently March 29th, 2024, 12:12 pm

Rotating buttons

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

jsmorley wrote:Yeah, I tend to stay away from organizing things around an arc, as the math involved just hurts my brain. Balala is good at all the Sine / Cosine stuff... ;-)
Many thanks jsmorley, for the trust...
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

balala wrote: Please let me know if this code works as you wanted. Also if you have further questions, feel free to ask.
The code seems promising. I will try it tomorrow and check if it works. Thanks for your time :D
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rotating buttons

Post by jsmorley »

CyberTheWorm wrote:Actually you can use H/W to resize the image, I have done it on a few of my meters.
Not on a button meter.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

kyriakos876 wrote:The code seems promising. I will try it tomorrow and check if it works. Thanks for your time :D
Ok, just let me know how does it match your needs.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rotating buttons

Post by jsmorley »

balala wrote:The image meters yes, the button ones not. Jsmorley had right (as usually), trust him. As he said, a proper TransformationMatrix option is the only possibility to rotate a button meter, but the resize hurts even with the TransformationMatrix.
Right. The point of a button meter is that it divides the image by three (horizontally or vertically, depending on which is larger) and in effect "crops" the image to the size needed to display the correct "frame" for the state of the button. If you were allowed to resize the image, it wouldn't work right at all.

With a Bar meter using a BarImage, and the Button meter, W and H are ignored. In those cases, the size of the original image is critical to the functionality and can't be changed.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

jsmorley wrote:Right. The point of a button meter is that it divides the image by three (horizontally or vertically, depending on which is larger) and in effect "crops" the image to the size needed to display the correct "frame" for the state of the button. If you were allowed to resize the image, it wouldn't work right at all.
Well, I never thought this, but it's perfectly logic.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

balala wrote:Ok, just let me know how does it match your needs.
So, I embed your code into mine and it works fine but how can I make the buttons have more distance from each other?
I can only modify the numbers for one quadrant every time. For example for the 1st quadrant I managed to do what I wanted by doing this:

Code: Select all

[B1]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((0*PI/12)+((#Quadrant#+1/12)*PI/2.2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((0*PI/12)+((#Quadrant#+1/12)*PI/2.2)))
DynamicVariables=1

[B2]
.
.
.
[B7]
If you compare it to your code I simply changed the numbers [from 0*PI/14 to 0*PI/12] and [from (#Quadrant#+1/14)*PI/2 to (#Quadrant#+1/12)*PI/2.2]

The above gives me the outcome I want for the 1st quadrant but messes up all of the others (2nd,3rd and 4th).
What should I change to have the same outcome for every quadrant ?

Also, I don't understand why put ((#Quadrant#>1)*#Radius# and not simply type in 0? That always gives 0 anyways...

By the way, even though I'm still trying to completely figure it out, that's one well written equation! :D
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

kyriakos876 wrote:So, I embed your code into mine and it works fine but how can I make the buttons have more distance from each other?
Increasing the Radius? Isn't this a good solution? Because it's the simplest.
kyriakos876 wrote:If you compare it to your code I simply changed the numbers [from 0*PI/14 to 0*PI/12] and [from (#Quadrant#+1/14)*PI/2 to (#Quadrant#+1/12)*PI/2.2]
I think that's not a good solution. I used 14 in the initial formulas, because we have there 7 buttons and the denominator must be equal with double of the number of buttons, so 12 would be a good value if we'd have 6 buttons.
kyriakos876 wrote:Also, I don't understand why put ((#Quadrant#>1)*#Radius# and not simply type in 0? That always gives 0 anyways...
I added those parts of the formulas, because we have to add a radius to X when we're in the third or fourth quadrant (for these, the value of the Quadrant variable is 2, respectively 3, not 3 and 4!), so, let's name this, the "left part". Same way, a Radius must be added to the Y, when we're in the second or third quadrant (when #Quadrant# is 1 or 2), which is the "upper part" of the skin. Otherwise in the respective quadrants, the buttons would go outside of the skin (to left or up).
Eg the value of the (#Quadrant#>1) expression is 1 for greater Quadrant values than 1 and it's 0 for lower ones, so depending on the value of this variable, #Radius# is added or not to the appropriate values of the X and Y.
kyriakos876 wrote:By the way, even though I'm still trying to completely figure it out, that's one well written equation! :D
Thanks.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

balala wrote:Increasing the Radius? Isn't this a good solution? Because it's the simplest.
If I do that the buttons go way to far from the main button and I don't want that.
balala wrote:I think that's not a good solution. I used 14 in the initial formulas, because we have there 7 buttons and the denominator must be equal with double of the number of buttons, so 12 would be a good value if we'd have 6 buttons.
Yeah I see this now and I feel stupid :P
balala wrote:I added those parts of the formulas, because we have to add a radius to X when we're in the third or fourth quadrant (for these, the value of the Quadrant variable is 2, respectively 3, not 3 and 4!), so, let's name this, the "left part". Same way, a Radius must be added to the Y, when we're in the second or third quadrant (when #Quadrant# is 1 or 2), which is the "upper part" of the skin. Otherwise in the respective quadrants, the buttons would go outside of the skin (to left or up).
Eg the value of the (#Quadrant#>1) expression is 1 for greater Quadrant values than 1 and it's 0 for lower ones, so depending on the value of this variable, #Radius# is added or not to the appropriate values of the X and Y.
I still don't get this part. I mean, I added a measure that, depending on the position of the main button, sets the #Quadrant# 1,2,3 and 4 respectively and it worked fine. That's probably because I use a different way to define the quadrant I wan to display than using:

Code: Select all

LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]
Both ways work fine though and it's none of our concern now :D If you could tell me how to spread the buttons even more without changing the radius that would be great! You've already helped me a lot with your formulas so don't sweat if you can't find a way. In the worst case I'll just make some modifications to my code! ^_^
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

kyriakos876 wrote:If I do that the buttons go way to far from the main button and I don't want that.
Yeah, but in this case I'm not sure how would you like to make them more distanced from each other. On a given radius, the position of the buttons depends just on the number of them (and their size, but that's given). You could spread them, only increasing the angle between them, but the sum of the angles must be 90 degrees. So, not sure what you would like to do...
kyriakos876 wrote:I still don't get this part. I mean, I added a measure that, depending on the position of the main button, sets the #Quadrant# 1,2,3 and 4 respectively and it worked fine. That's probably because I use a different way to define the quadrant I wan to display than using:
In fact the possible values of the Quadrant variable are from 0 to 3, not from 1 to 4.
In the attached image, I've indicated the value of the Quadrant variable, for each quadrant. No matter how do you set the value of the Quadrant variable, if you do.
You do not have the required permissions to view the files attached to this post.