It is currently March 29th, 2024, 2:32 pm

Sliding a Skin with ActionTimer

Our most popular Tips and Tricks from the Rainmeter Team and others
Honimoura
Posts: 94
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: 571
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: 26
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: 26
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: 16110
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.
User avatar
version
Posts: 26
Joined: June 9th, 2020, 9:35 am

Re: Sliding a Skin with ActionTimer

Post by version »

Thanks balala for the suggestions.

That has seemed to help in the cpu usage slightly and all is working well.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sliding a Skin with ActionTimer

Post by balala »

version wrote: June 15th, 2020, 1:15 am That has seemed to help in the cpu usage slightly and all is working well.
Did it? I'm glad in this case.
User avatar
Neocube
Posts: 8
Joined: October 14th, 2021, 7:34 pm
Location: USA

Re: Sliding a Skin with ActionTimer

Post by Neocube »

DanielPodo wrote: May 16th, 2016, 8:50 pm ...

Image

...
First of all... really cool! Second, I am still a beginner at the rainmeter thing let alone the fact that you are speaking post-graduate level "blah" lol. I would never understand any of that. But, is the skin for this available by chance? I mean, would love to have it if it is available as it is sweet!

I do understand this post was 8+ years ago but still I figured I would try.

Thanks either way my friend. Talent needs to be recognized!
User avatar
Yincognito
Rainmeter Sage
Posts: 7030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Sliding a Skin with ActionTimer

Post by Yincognito »

Neocube wrote: January 2nd, 2024, 9:35 am First of all... really cool! Second, I am still a beginner at the rainmeter thing let alone the fact that you are speaking post-graduate level "blah" lol. I would never understand any of that. But, is the skin for this available by chance? I mean, would love to have it if it is available as it is sweet!

I do understand this post was 8+ years ago but still I figured I would try.

Thanks either way my friend. Talent needs to be recognized!
I don't know whether it has the animation presented in that GIF, but just by looking through DanielPodo's posts on the forum, this seems close to what he presented:
https://forum.rainmeter.net/viewtopic.php?t=23440

That being said, he mentioned that his skin is itself a rewrite of another skin, so not sure if it's what you're after. If anything, you could search by image using that GIF, maybe you'll get lucky and find closer matches for it.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
DanielPodo
Posts: 77
Joined: March 30th, 2016, 1:50 pm

Re: Sliding a Skin with ActionTimer

Post by DanielPodo »

Neocube wrote: January 2nd, 2024, 9:35 am First of all... really cool! Second, I am still a beginner at the rainmeter thing let alone the fact that you are speaking post-graduate level "blah" lol. I would never understand any of that. But, is the skin for this available by chance? I mean, would love to have it if it is available as it is sweet!

I do understand this post was 8+ years ago but still I figured I would try.

Thanks either way my friend. Talent needs to be recognized!
Ha! You're in luck!

After taking a few years break (due to a lot of personal sh*t going down in my life), I'm slowly getting back into all the things I left over the years, includinng making Rainmeter skins.

Dm sent!