It is currently April 20th, 2024, 4:22 am

Rotating buttons

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rotating buttons

Post by jsmorley »

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... ;-)
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

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... ;-)
I'm gonna stick with X's and Y's then unless Balala replies, sharing some of his genius on this one :D
Again, thanks!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rotating buttons

Post by jsmorley »

Glad to help.

I'm sure balala will weigh in. He has done stuff like that before.

I tend to be more boring and linear... ;-)
1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

jsmorley wrote:
I tend to be more boring and linear... ;-)
Looks clean and nice :D
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

Hi, I'm here now. So, what would you like to do? If I'll be able, I'll try to figure it out.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Rotating buttons

Post by kyriakos876 »

balala wrote:Hi, I'm here now. So, what would you like to do? If I'll be able, I'll try to figure it out.
Hey there, I'm glad you are here :D
So, what I want to do is find a formula? or a set of commands? or whatever makes it less complicated than that it already is.
In the skin below you will notice 4 Sets of commands(In the variables.ini) , each for every quarter of the screen.

The formula (or something like that) I want to find is something that doesn't require to write a new value for every quarter of the screen but one X or one Y that works for every quarter.

For example have the X and Y of each Button set as variables including the WORKAREAWIDTH and the MainX and MainY (as set in the variables.ini) variables.

Note: You will have to click 2 times to get the corresponding buttons every time you change the position of the main button to a different quarter of the screen (I'm working on it to make it work with one click :P ). Don't mind any needless meters/measures you may encounter, focus on replacing these 4 Sets in Variables.ini with X's and Y's that depend on the position of the main button :D

(The skins is attached below)
You do not have the required permissions to view the files attached to this post.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Rotating buttons

Post by CyberTheWorm »

jsmorley wrote:I'm not a huge fan of the Button meter, as it does have limitations. You can't ever "size" the button with W and / or H, and you can't use Image options like ImageRotate. Personally, I find that three images, using all the various mouse hover and click options, gives me the best control while keeping all the flexibility of the Image meter.
Actually you can use H/W to resize the image, I have done it on a few of my meters.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

Hi kyriakos876 and sorry for the late reply.

So, first modify the X and Y options of each of the [B1] - [B7] meters, as it follows. Also add the indicated options to each of them:

Code: Select all

[B1]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((0*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((0*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B2]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((1*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((1*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B3]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((2*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((2*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B4]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((3*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((3*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B5]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((4*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((4*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B6]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((5*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((5*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]

[B7]
Meter=Button
ButtonImage=#S#
X=((#Quadrant#>1)*#Radius#+#Radius#*Sin((6*PI/14)+((#Quadrant#+1/14)*PI/2)))
Y=(((#Quadrant#=1)||(#Quadrant#=2))*#Radius#+#Radius#*Cos((6*PI/14)+((#Quadrant#+1/14)*PI/2)))
DynamicVariables=1
Group=Buttons
LeftMouseUpAction=[!SetVariable Quadrant "((#Quadrant#+1)%4)"][!UpdateMeterGroup "Buttons"][!Redraw]
The Radius variable is the radius of the circle (obviously in pixels) and Quadrant indicates which quadrant will be used. The above code will work if you also add to the [Variables] section (or to the [Variables] section of the included file - Variables.ini - and probably this will be the solution you'll want to use) the following variables:

Code: Select all

[Variables]
...
Radius=200
Quadrant=0
You can freely change the value of the Radius variable to set the radius of the circle to the desired value. Changing the value of the Quadrant variable, you'll set the used corner. I added to each of the [B1] - [B7] meters, the LeftMouseUpAction option, to can set dynamically the value of this last variable. You probably will want to replace these options and add a such option somewhere else, but right now, it's not clear yet where will it be added. Anyway, if you'll add it, don't forget to add to the respective meter, the DynamicVariables=1 option, otherwise it won't set the appropriate quadrant.
You'll also have to adjust the position of the [Main] meter, within the BMRoundDock.ini meter, according to which quadrant is set into the Secondary.ini skin.
Please let me know if this code works as you wanted. Also if you have further questions, feel free to ask.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

Sorry I forgot, but I think you'll have to remove the Set1 - Set4 variables within the @Resources\Variables.ini file, otherwise on each refresh of the BMRoundDock.ini or reload of the Secondary.ini, the old values of the X and Y options of the [B1] - [B7] meter will be rewritten to the initial values.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotating buttons

Post by balala »

CyberTheWorm wrote:Actually you can use H/W to resize the image, I have done it on a few of my meters.
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.
Last edited by balala on March 12th, 2017, 8:15 pm, edited 1 time in total.