It is currently March 29th, 2024, 1:21 pm

Actionscript Plugin Help: Timed sequenced fade in/out images

Get help with creating, editing & fixing problems with skins
RandomUser121
Posts: 2
Joined: July 17th, 2018, 5:29 am

Actionscript Plugin Help: Timed sequenced fade in/out images

Post by RandomUser121 »

Backstory (Dont bother reading)
I was making a minimalist desktop (or at least trying to) but needed a way to hide buttons/images/launchers/otherskins. I had a google search or two and a bit of fiddling, i successfully had a button that triggered other rainmeter skins to appear, then dissapear on click (with fade effect).
Problem was, i Wanted the images to appear in a specific order when pressing a button. I tried action script and tried altering code from other people's similar issues https://forum.rainmeter.net/viewtopic.php?f=5&t=21756&start=10 but nothing worked. its been a few days now and im was at my last resort, so i took to the forums. Now here i am.

TL;DR/Overall Question
I need help making the correct code to allow images to fade in one by one after pressing a button.

What i tried
Altering the code from a previous post https://forum.rainmeter.net/viewtopic.php?f=5&t=21756 (its the one at the bottom of the page that has a toggle button that opens up 5 more buttons) so that it supports images rather than a string.

What im looking for
(sorry if its hard to do) An image, that when pressed opens up multiple images (fades in) at different intervals that can be changed through variables.

PC Info (if needed)
4.1.0 r2989 64-bit (Nov 6 2017)
Windows 10 Pro 64-bit (build 17134)
Path: C:\z.Literally Everything\Rainmeter\
IniFile: C:\Users\Sam\AppData\Roaming\Rainmeter\Rainmeter.ini
SkinPath: C:\Users\Sam\Documents\Rainmeter\Skins\

Please Note
Sorry for any english errors
Also, i have little coding experience with rainmeter specifically.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Actionscript Plugin Help: Timed sequenced fade in/out images

Post by balala »

RandomUser121 wrote:What im looking for
(sorry if its hard to do) An image, that when pressed opens up multiple images (fades in) at different intervals that can be changed through variables.
Here is a first attempt to create a such code, using the ActionTimer plugin. I added just two Image meters for now and used just solid colors, instead of adding images.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Fade1=0
Fade2=0
Start1=0
Start2=0
Wait=3
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeterGroup "Fade"][!UpdateMeterGroup "Images"][!Redraw]

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat FadeIn1,20,10
FadeIn1=[!SetVariable Fade1 "(Clamp((#Fade1#+1),0,10))"]#U#
ActionList2=Repeat FadeOut1,20,10
FadeOut1=[!SetVariable Fade1 "(Clamp((#Fade1#-1),0,10))"]#U#
ActionList3=Repeat FadeIn2,20,10
FadeIn2=[!SetVariable Fade2 "(Clamp((#Fade2#+1),0,10))"]#U#
ActionList4=Repeat FadeOut2,20,10
FadeOut2=[!SetVariable Fade2 "(Clamp((#Fade2#-1),0,10))"]#U#
DynamicVariables=1

[MeasureFade1]
Measure=Calc
Formula=( #Start1# + #Fade1# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!CommandMeasure "MeasureSlide" "Stop 2"][!CommandMeasure "MeasureSlide" "Stop 3"][!CommandMeasure "MeasureSlide" "Stop 4"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!CommandMeasure "MeasureSlide" "Execute 1"][!CommandMeasure "MeasureSlide" "Stop 2"][!CommandMeasure "MeasureSlide" "Stop 3"][!CommandMeasure "MeasureSlide" "Stop 4"][!SetVariable Start1 "0"][!UpdateMeasure "#CURRENTSECTION#"]
IfCondition3=(#CURRENTSECTION#>=10)
IfTrueAction3=[!Delay "(1000*#Wait#)"][!SetVariable Start2 "1"][!UpdateMeasure "MeasureFade2"][!Redraw]
DynamicVariables=1
Group=Fade

[MeasureFade2]
Measure=Calc
Formula=( #Start2# + #Fade2# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!CommandMeasure "MeasureSlide" "Execute 2"][!CommandMeasure "MeasureSlide" "Stop 3"][!CommandMeasure "MeasureSlide" "Stop 4"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!CommandMeasure "MeasureSlide" "Stop 1"][!CommandMeasure "MeasureSlide" "Stop 2"][!CommandMeasure "MeasureSlide" "Execute 3"][!CommandMeasure "MeasureSlide" "Stop 4"][!Delay "0"][!SetVariable Start2 "0"][!UpdateMeasure "#CURRENTSECTION#"][!Redraw]
IfCondition3=(#CURRENTSECTION#>=10)
IfTrueAction3=[!Delay "(1000*#Wait#)"][!CommandMeasure "MeasureSlide" "Stop 1"][!CommandMeasure "MeasureSlide" "Stop 2"][!CommandMeasure "MeasureSlide" "Stop 3"][!CommandMeasure "MeasureSlide" "Execute 4"]
DynamicVariables=1
Group=Fade

[MeterStart]
Meter=Image
SolidColor=0,255,0
X=0
Y=0
W=50
H=25
LeftMouseUpAction=[!SetVariable Start1 "1"][!UpdateMeasure "MeasureFade1"][!Redraw]

[MeterImage1]
Meter=Image
Solidcolor=255,0,0,(25.5*#Fade1#)
X=0r
Y=5R
W=100
H=50
DynamicVariables=1
Group=Images

[MeterImage2]
Meter=Image
Solidcolor=255,240,0,(25.5*#Fade2#)
X=0r
Y=5R
W=100
H=50
DynamicVariables=1
Group=Images
You can easily rewrite the Image meters to use certain images instead of the SolidColor. If you do so, add an ImageAlpha=(25.5*#Fade1#) (to [MeterImage1]), respectively an ImageAlpha=(25.5*#Fade2#) (to [MeterImage2]) option.
RandomUser121
Posts: 2
Joined: July 17th, 2018, 5:29 am

Re: Actionscript Plugin Help: Timed sequenced fade in/out images

Post by RandomUser121 »

Thankyou so much
This fixed the problem, thanks for everything :D
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Actionscript Plugin Help: Timed sequenced fade in/out images

Post by balala »

Glad to help.