It is currently July 12th, 2020, 12:12 am

Sliding a Skin with ActionTimer

Our most popular Tips and Tricks from the Rainmeter Team and others
scottiescotsman
Posts: 59
Joined: June 10th, 2013, 2:22 am

Re: Sliding a Skin with ActionTimer

Post by scottiescotsman »

The 3 include files :)
Hope that helps

Thanks
Steven
You do not have the required permissions to view the files attached to this post.
dvo
Posts: 818
Joined: February 7th, 2016, 6:08 am

Re: Sliding a Skin with ActionTimer

Post by dvo »

here the working version maybe you will alter some parts but the basics are working nice :D
You do not have the required permissions to view the files attached to this post.
dvo
Posts: 818
Joined: February 7th, 2016, 6:08 am

Re: Sliding a Skin with ActionTimer

Post by dvo »

this is a auto slider maybe you like this one better :D
You do not have the required permissions to view the files attached to this post.
Honimoura
Posts: 77
Joined: April 3rd, 2018, 11:15 am

Re: Sliding a Skin with ActionTimer

Post by Honimoura »

Hello, I just discovered this option. I use it a little differently. I use it to click on one of the skin, it "unwinds" icons to create a menu. However I am looking for how to make a slide of the skins on a arc path.

In order to be as clear as possible. The base skin is a circle, so I want to scroll the "icons" around this circle in sliding.

(Sorry, i'm french, google trad power)
User avatar
ikarus1969
Posts: 367
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Sliding a Skin with ActionTimer

Post by ikarus1969 »

Honimoura wrote:
June 25th, 2019, 6:19 pm
Hello, I just discovered this option. I use it a little differently. I use it to click on one of the skin, it "unwinds" icons to create a menu. However I am looking for how to make a slide of the skins on a arc path.

In order to be as clear as possible. The base skin is a circle, so I want to scroll the "icons" around this circle in sliding.

(Sorry, i'm french, google trad power)
As a starting point you can use the following demonstrating skin where blue circles rotate on a circle when hovering over the red base rectangle (and back when leaving the red base rectangle):

A little math:
the x-position of an object on a circle is calculated by.
[x-coordinate of the middle of the circle] + [radius of the circle] * COSINUS(angle)
the y-position of an object on a circle is calculated by.
[y-coordinate of the middle of the circle] + [radius of the circle] * SINUS(angle)

(see polar-coordinates on wikipedia (french): https://fr.wikipedia.org/wiki/Coordonn%C3%A9es_polaires)

sliding is done by increasing (or decreasing) the angle with an action-timer measure
Screenshot skin.jpg

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
OnWakeAction=[!Refresh]
DynamicWindowSize=1
; BackgroundMode=2
; SolidColor=4080C040

[Variables]
CIRCLE.X=130
CIRCLE.Y=130
CIRCLE.R=100

; starting angles in degrees, starting on the right (=east)
; angle for the red base
ANGLE.Base=180

; angles for the blue circles which will rotate upon mouse move over (and out) of the red base
ANGLE.Icon.1=220
ANGLE.Icon.2=265
ANGLE.Icon.3=337


Base.W=40
Base.H=#Base.W#

Icon.R=20


; for ActionTimer
AT_Angle=0
UAT_Angle=[!UpdateMeasure "Measure_AT_Angle"][!UpdateMeterGroup "G_ICON"][!Redraw]


; --------------------------------------------------------------------------------
; Measures
; --------------------------------------------------------------------------------

[Measure_AT_Angle]
Measure=PLUGIN
Plugin=ActionTimer
ActionList1=Repeat ROTATE_RIGHT, 7, 80 | Wait 7 | ROTATE_RIGHT_FINAL
ActionList2=Repeat ROTATE_LEFT,  7, 80 | Wait 7 | ROTATE_LEFT_FINAL
ROTATE_RIGHT=      [!SetVariable "AT_Angle" "(MIN(80, #AT_Angle# + 1))"]#UAT_Angle#
ROTATE_RIGHT_FINAL=[!SetVariable "AT_Angle" "80"]#UAT_Angle#
ROTATE_LEFT=       [!SetVariable "AT_Angle" "(MAX(0, #AT_Angle# - 1))"]#UAT_Angle#
ROTATE_LEFT_FINAL= [!SetVariable "AT_Angle" "0"]#UAT_Angle#
DynamicVariables=1
UpdateDivider=-1
IgnoreWarnings=1


; --------------------------------------------------------------------------------
; Meters
; --------------------------------------------------------------------------------
[Meter_Circle]
Meter=SHAPE
Shape= Ellipse #CIRCLE.X#, #CIRCLE.Y#, #CIRCLE.R#, #CIRCLE.R# | Extend Format_Circle
Format_Circle=StrokeWidth 2 | Stroke Color 800000FF | Fill Color FFFFFFFF
AntiAlias=1
DynamicVariables=1

[Meter_Base]
Meter=SHAPE
Shape=Rectangle (#CIRCLE.X# + (#CIRCLE.R# + 0.5 * #Base.W#) * COS(RAD(#ANGLE.Base#))), (#CIRCLE.Y# + (#CIRCLE.R# + 0.5 * #Base.W#) * SIN(RAD(#ANGLE.Base#))), #Base.W#, #Base.W# | Extend Format_Base
Format_Base=StrokeWidth 2 | Stroke Color 800000FF | Fill Color FF0000FF
MouseOverAction= [!CommandMeasure "Measure_AT_Angle" "Stop 1"][!CommandMeasure "Measure_AT_Angle" "Stop 2"][!CommandMeasure "Measure_AT_Angle" "Execute 1"]
MouseLeaveAction=[!CommandMeasure "Measure_AT_Angle" "Stop 1"][!CommandMeasure "Measure_AT_Angle" "Stop 2"][!CommandMeasure "Measure_AT_Angle" "Execute 2"]
AntiAlias=1
DynamicVariables=1

[Meter_Icon_1]
Meter=SHAPE
Shape= Ellipse (#CIRCLE.X# + #CIRCLE.R# * COS(RAD(#ANGLE.Icon.1# + #AT_Angle#))), (#CIRCLE.Y# + #CIRCLE.R# * SIN(RAD(#ANGLE.Icon.1# + #AT_Angle#))), #Icon.R#, #Icon.R# | Extend Format_Icon
Format_Icon=StrokeWidth 2 | Stroke Color 004080FF | Fill Color 80BFFFFF
AntiAlias=1
DynamicVariables=1
Group=G_ICON

[Meter_Icon_2]
Meter=SHAPE
Shape= Ellipse (#CIRCLE.X# + #CIRCLE.R# * COS(RAD(#ANGLE.Icon.2# + #AT_Angle#))), (#CIRCLE.Y# + #CIRCLE.R# * SIN(RAD(#ANGLE.Icon.2# + #AT_Angle#))), #Icon.R#, #Icon.R# | Extend Format_Icon
Format_Icon=StrokeWidth 2 | Stroke Color 004080FF | Fill Color 80BFFFFF
AntiAlias=1
DynamicVariables=1
Group=G_ICON

[Meter_Icon_3]
Meter=SHAPE
Shape= Ellipse (#CIRCLE.X# + #CIRCLE.R# * COS(RAD(#ANGLE.Icon.3# + #AT_Angle#))), (#CIRCLE.Y# + #CIRCLE.R# * SIN(RAD(#ANGLE.Icon.3# + #AT_Angle#))), #Icon.R#, #Icon.R# | Extend Format_Icon
Format_Icon=StrokeWidth 2 | Stroke Color 004080FF | Fill Color 80BFFFFF
AntiAlias=1
DynamicVariables=1
Group=G_ICON
You do not have the required permissions to view the files attached to this post.
Honimoura
Posts: 77
Joined: April 3rd, 2018, 11:15 am

Re: Sliding a Skin with ActionTimer

Post by Honimoura »

Thank you for that answer. It sounds EXTREMELY complicated at first sight, but I'm going to put my hands in to fully understand each step and come back to you to give the final result if I succeed ^^
User avatar
ikarus1969
Posts: 367
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Sliding a Skin with ActionTimer

Post by ikarus1969 »

Honimoura wrote:
June 26th, 2019, 11:06 pm
Thank you for that answer. It sounds EXTREMELY complicated at first sight, but I'm going to put my hands in to fully understand each step and come back to you to give the final result if I succeed ^^
You are right. At first sight. But at the second view it isn't. Just imagine:
  1. to position something at a circle, you have to define the angle.
  2. to slide (move) something on a circle you have to change that angle (increase/decrease)
for 1. just set a variable to that angle. This variable is used in the meter when defining the x and y-coordinates
for 2. changing the angle is done by an action-timer measure which, well, changes the angle and updates the meter to reflect the new position

The only thing - for me - was to remember my time in school when i learned how something is positioned on a circle. For this question Wikipedia helped me with the polar coordinates.
For positioning something on a circle, i need 3 things:
  1. the center of the circle (x- and y-coordinates): i use variables for it, so i can easily use them in formulas
  2. the radius of the circle
  3. the angle at which the "something" should appear
All these 3 things are under my control, i define them. And set them in variables. So i can do position the "something" easily on a circle:

x-position:

Code: Select all

[x-coordinate of the center of the circle] + [radius of the circle] * cosinus(angle)
y-position:

Code: Select all

[y-coordinate of the center of the circle] + [radius of the circle] * sinus(angle)

please don't hesitate to ask questions whenever they arise!
User avatar
version
Posts: 4
Joined: June 9th, 2020, 9:35 am

Re: Sliding a Skin with ActionTimer

Post by version »

Hi guys and girls...

Thanks in advance for any assistance. :D

I've used jsmorley's skin sliding code. I'm using it for a music player and want it to slide/hide only when there is no music playing.

I've tried a few things without any luck and haven't done much with actiontimer etc yet so a little over my head atm.
I do have a measure setup to detect the 'player' state but not sure how to trigger the menu to hide or close by itself.

Cheers.

This is the initial code that i used for the sliding skin.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=220
SkinHeight=185

[Metadata]
Name=SlideDemo\SimpleToRight
Author=JSMorley
Version=May 11, 2016
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Demonstration of using ActionTimer to slide out a panel

[Variables]
OffSet=-190
State=1
U=[!UpdateMeasure MeasureSlider][!UpdateMeter *][!Redraw]

; Slider Measure

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideRight, 2, 22
SlideRight=[!SetVariable State "2"][!SetVariable OffSet "(Clamp(#OffSet#+9,-190,0))"]#U#
ActionList2=Repeat SlideLeft, 2, 22
SlideLeft=[!SetVariable State "1"][!SetVariable OffSet "(Clamp(#OffSet#-9,-190,0))"]#U#
DynamicVariables=1

; Meters

[MeterBack]
Meter=Image
X=#OffSet#
W=220
H=185
SolidColor=16,42,55,255
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute #State#"]
User avatar
version
Posts: 4
Joined: June 9th, 2020, 9:35 am

Re: Sliding a Skin with ActionTimer

Post by version »

I actually solved this. Not sure if it's the best way to do it though as i'm seeing higher CPU usage on Rainmeter so suspecting im creating some loop somewhere.

This is the code i used to autohide the sliding skin for anyone else looking for a solution to this.

Code: Select all

[MeasurePlayerState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasurePlayer]
PlayerType=State
IfCondition=MeasurePlayerState = 1
IfTrueAction=[!CommandMeasure MeasureSlider "Execute 1"]
IfFalseAction=[!DisableMeasureGroup "Vismeasure"][!HideMeterGroup "VisMeter"][!CommandMeasure MeasureSlider "Execute 2"]
DynamicVariables=1
Is there a better way to trigger the sliding skin?

Thanks
User avatar
balala
Rainmeter Sage
Posts: 11009
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sliding a Skin with ActionTimer

Post by balala »

version wrote:
June 14th, 2020, 4:28 am
This is the code i used to autohide the sliding skin for anyone else looking for a solution to this.
I have one single suggestion for you: on both options IfTrueAction and IfFalseAction, beside the Execute statement, you should also add some bangs to stop the other command:

Code: Select all

[MeasurePlayerState]
...
IfCondition=MeasurePlayerState = 1
IfTrueAction=[!CommandMeasure MeasureSlider "Execute 1"][!CommandMeasure MeasureSlider "Stop 2"]
IfFalseAction=[!DisableMeasureGroup "Vismeasure"][!HideMeterGroup "VisMeter"][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Execute 2"]
...
Also note that NowPlaying is not anymore a plugin, in meantime it became an internal measure, so accordingly the Measure=Plugin and Plugin=NowPlaying.dll options pair should be replaced by the much simpler Measure=NowPlaying.