Hi,
I am trying to make a skin where I can rotate some image elements using the mouse actions.
Is it possible to make an image rotate clockwise and counter-clockwise in small increments using MouseScrollDownAction / MouseScrollUpAction adjusting a counter that is used to set the angle of rotation?
It is currently April 28th, 2024, 12:38 am
Image rotation using mouse actions
-
- Posts: 7
- Joined: May 6th, 2012, 12:06 am
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image rotation using mouse actions
I would not use the rotation angle and such really, but would rather use the scroll actions to control a measure that is used as the "value" for a Rotator image.
Something like:
http://docs.rainmeter.net/manual-beta/meters/rotator
* Skin requires the latest beta 2.5 of Rainmeter.
Something like:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
ImageW=195
ImageH=195
[MeasureInc]
Measure=Calc
Formula=0
MinValue=0
MaxValue=360
[MeterKnob]
Meter=Rotator
MeasureName=MeasureInc
ImageName=#@#Images\Knob.png
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH# / 2)
W=#ImageW#
H=#ImageH#
MouseScrollDownAction=[!SetOption MeasureInc Formula "([MeasureInc] + 10 > 360 ? 360 : ([MeasureInc] + 10))"][!UpdateMeasure MeasureInc][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetOption MeasureInc Formula "([MeasureInc] - 10 < 0 ? 0 : ([MeasureInc] - 10))"][!UpdateMeasure MeasureInc][!UpdateMeter *][!Redraw]
DynamicVariables=1
[MeterValue]
Meter=String
MeasureName=MeasureInc
X=(#ImageW# / 2)
Y=(#ImageH# / 2)
FontFace=Segoe UI
FontSize=22
FontColor=53,105,51,255
StringStyle=Bold
StringAlign=CenterCenter
AntiAlias=1
* Skin requires the latest beta 2.5 of Rainmeter.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 7
- Joined: May 6th, 2012, 12:06 am
Re: Image rotation using mouse actions
That's exactly what I was looking for!!!
Thank you so very much. I have been looking this for a long time.
Thank you so very much. I have been looking this for a long time.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image rotation using mouse actions
Glad to help.
-
- Posts: 7
- Joined: May 6th, 2012, 12:06 am
Re: Image rotation using mouse actions
BTW, is there a way to make the testknob skin able to rotate continuosly instead of stopping at 360 degrees?
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image rotation using mouse actions
o2r wrote:BTW, is there a way to make the testknob skin able to rotate continuosly instead of stopping at 360 degrees?
Code: Select all
MouseScrollDownAction=[!SetOption MeasureInc Formula "([MeasureInc] + 10 > 360 ? 10 : ([MeasureInc] + 10))"][!UpdateMeasure MeasureInc][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetOption MeasureInc Formula "([MeasureInc] - 10 < 10 ? 360 : ([MeasureInc] - 10))"][!UpdateMeasure MeasureInc][!UpdateMeter *][!Redraw]
-
- Posts: 1740
- Joined: November 13th, 2012, 9:53 pm
Re: Image rotation using mouse actions
there would be a small jump from 351 to 10 in the first rotation when scrolling down.
this should be (very little) smoother:
this should be (very little) smoother:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
ImageW=195
ImageH=195
[MeasureInc]
Measure=Calc
Formula=0
MinValue=0
MaxValue=359
[MeterKnob]
Meter=Rotator
MeasureName=MeasureInc
ImageName=#@#Images\Knob.png
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH# / 2)
W=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
H=(SQRT(#ImageW# ** 2 + #ImageH# ** 2))
MouseScrollDownAction=[!SetOption MeasureInc Formula "([MeasureInc] + 10 > 350 ? 0 : ([MeasureInc] + 10))"][!UpdateMeasure MeasureInc][!UpdateMeter MeterKnob][!Redraw]
MouseScrollUpAction=[!SetOption MeasureInc Formula "([MeasureInc] - 10 < 0 ? 350 : ([MeasureInc] - 10))"][!UpdateMeasure MeasureInc][!UpdateMeter MeterKnob][!Redraw]
DynamicVariables=1
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image rotation using mouse actions
Moshi,moshi wrote:there would be a small jump from 351 to 10 in the first rotation when scrolling down.
I think you might be working off of an older version of the code I have since updated. What is there now, with the changes I just posted in the message above, should work ok.
-
- Posts: 1740
- Joined: November 13th, 2012, 9:53 pm
Re: Image rotation using mouse actions
you're right.
mine is still (very, very little now) better as:
would divide the circle by 361.
but that's really not visible.
mine is still (very, very little now) better as:
Code: Select all
[MeasureInc]
Measure=Calc
Formula=0
MinValue=0
MaxValue=360
but that's really not visible.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Image rotation using mouse actions
Ah, ok.moshi wrote:you're right.
mine is still (very, very little now) better as:
would divide the circle by 361.Code: Select all
[MeasureInc] Measure=Calc Formula=0 MinValue=0 MaxValue=360
but that's really not visible.