It is currently March 28th, 2024, 2:40 pm

play and stop audio files

Get help with installing and using Rainmeter.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Or you could do something like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Alpha=255
Current=1
Color1=159,237,141
Color2=254,235,96
Color3=248,17,0
Color4=58,123,255

[MeasureTimer]
Measure=Calc
Formula=1
UpdateDivider=5
OnUpdateAction=[!UpdateMeasure MeasureRandom]

[MeasureRandom]
Measure=Calc
Formula=Random
UpdateRandom=1
UniqueRandom=1
LowBound=1
HighBound=4
UpdateDivider=-1
OnChangeAction=[!ShowMeter MeterMerry][!CommandMeasure MeasureFade "Execute 1"]

[MeterMerry]
Meter=String
FontFace=Beyond Wonderland
FontSize=80
FontColor=[#Color[#Current]],[#Alpha]
SolidColor=0,0,0,1
Hidden=1
DynamicVariables=1
Text=Merry Christmas

[MeasureFade]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeOut,5,16 | Wait 1 | SetColor | Wait 1| Repeat FadeIn,5,128
FadeOut=[!SetVariable Alpha "(Clamp([#Alpha]-16,0,255))"][!UpdateMeasure MeasureFade][!UpdateMeter *][!Redraw]
SetColor=[!SetVariable Current [&MeasureRandom]][!UpdateMeter *][!Redraw]
FadeIn=[!SetVariable Alpha "(Clamp([#Alpha]+2,0,255))"][!UpdateMeasure MeasureFade][!UpdateMeter *][!Redraw]
IgnoreWarnings=1
DynamicVariables=1
1.jpg
Click to animate
GIF.gif
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ok, I have another quick question since you seem to be a master at this lol...
say I have a font, which in my case is a "dingbat" and I want a gradient color on it how can I get that to work? something sort of like top blue, middle red, bottom green (or what ever colors I want) also, is there a way to make the gradient do a smooth cycle sort of like a rainbow effect?
thanks
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

A gradient color on a string is relatively simple:

https://docs.rainmeter.net/manual-beta/meters/string/inline/#InlineGradientColor

Getting it to "rotate" through 3 or more colors would be an approach similar to what I just posted, using the ActionTimer plugin. I think with the start I have given you on that, you might be able to hassle through it. It won't be trivial to do, but I suspect possible. The tricky bit, which is tricky indeed (I haven't figured out a reasonable way to do it) is to "transition" colors from one to another in the same meter over time. You can't just "replace" one color with another, so you have to change the various red/green/blue values up and down to fade from one color to another, and that is tough nut to crack properly.

Edit: I think in this case, there may be something more clever. Use the ActionTimer plugin to change the "percentage position" values of the various gradient colors within the gradient over time. So rather than "changing" the gradient colors at all, you just "move" them.

I caution that we don't recommend using ActionTimer in a "constant / endless" way. While it is very efficient, it's not "free", and having something that is taking dozens or hundreds of actions (including skin redraws) every second can use a lot of CPU indeed. Be sure that if you are going to have this be "endless", based on some OnUpdateAction, that you give Rainmeter a decent "breather" in between calls to the plugin ActionList(N) actions. Overwhelming the Rainmeter message queue can cause all kinds of instability, like laggy mouse detection.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ok thanks, not all that worried about the resources being used since I am running a quad core at 4.7Ghz and 16GB Ram.
I thought it could be done, just wasn't sure about getting the gradient going with it. I'll work on this later when I am done with everything and report back as to how it went.
thanks a lot man.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

I'd be tempted to jump out to Lua to do the calculations, although I don't doubt they can be done withe some clever Calc measures or something.

Skin:

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Variables]
Color3=159,237,141
Color1=248,17,0
Color2=58,123,255

[Lua]
Measure=Script
ScriptFile=Test.lua

[MeterMerry]
Meter=String
FontFace=Beyond Wonderland
FontSize=80
InlineSetting=GradientColor | 180 | [#Color1] ; [&Lua:color1Pos] | [#Color2] ; [&Lua:color2Pos] | [#Color3] ; [&Lua:color3Pos]
SolidColor=0,0,0,1
DynamicVariables=1
Text=Merry Christmas
Test.lua:

Code: Select all

function Initialize()

	color1Pos=0.2
	color2Pos=0.5
	color3Pos=0.8

end

function Update()

	color1Pos = color1Pos + 0.1
	if color1Pos > 0.8 then color1Pos = 0.0 end
	color2Pos = color2Pos + 0.1
	if color2Pos > 0.8 then color2Pos = 0.0	 end
	color3Pos = color3Pos + 0.1
	if color3Pos > 0.8 then color3Pos = 0.0 end
	
end
Click to animate
gif1.gif
or with the gradient at 90 degrees..
gif2.gif
Note: Be aware of what order you use the colors in. The color spectrum is based on "hue", which looks like this. The same "red" is at both ends. While the gradient will figure out the shortest "distance" between two colors, if you transition from red to blue to green, you go through purple, while transitioning from red to green to blue goes through yellow. Depends on what you want. I'd be tempted to use four colors instead of three, so you can more certainly "force" the direction of the transition. Red to Yellow to Green to Blue for instance.
1.png
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

perfect!
thanks!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Actually tricky to keep the "direction" of the transition consistent. While its visibly ok, even interesting, when you have a "rotation" that goes red > green > blue > red > green > blue > red for instance, and move the percentages, when it is transitioning from red > green > blue it goes through yellow, but then when it "starts over" and transitions from blue > red, it goes through purple. By design it will always choose the "shortest" path. Well, close enough for government work...
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ok, so is this right?...

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Variables]
Color3=159,237,141
Color1=248,17,0
Color2=58,123,255

[Lua]
Measure=Script
ScriptFile=Test.lua

[MeterMerry]
Meter=String
FontFace=Beyond Wonderland
FontSize=80
InlineSetting=GradientColor | 180 | [#Color1] ; [&Lua:color1Pos] | [#Color2] ; [&Lua:color2Pos] | [#Color3] ; [&Lua:color3Pos]
SolidColor=0,0,0,1
DynamicVariables=1
Text=Happy

function Initialize()

   color1Pos=0.2
   color2Pos=0.5
   color3Pos=0.8

end

function Update()

   color1Pos = color1Pos + 0.1
   if color1Pos > 0.8 then color1Pos = 0.0 end
   color2Pos = color2Pos + 0.1
   if color2Pos > 0.8 then color2Pos = 0.0    end
   color3Pos = color3Pos + 0.1
   if color3Pos > 0.8 then color3Pos = 0.0 end
   
end
some how I think I missed something somewhere because I just get the text in a yellow green color with no effects lol, doing like 3 things at once and my Fiance keeps bugging me as well lol
Last edited by Cellinarac on November 5th, 2017, 3:35 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: play and stop audio files

Post by jsmorley »

Cellinarac wrote:ok, so is this right?...

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Variables]
Color3=159,237,141
Color1=248,17,0
Color2=58,123,255

[Lua]
Measure=Script
ScriptFile=Test.lua

[MeterMerry]
Meter=String
FontFace=Beyond Wonderland
FontSize=80
InlineSetting=GradientColor | 180 | [#Color1] ; [&Lua:color1Pos] | [#Color2] ; [&Lua:color2Pos] | [#Color3] ; [&Lua:color3Pos]
SolidColor=0,0,0,1
DynamicVariables=1
Text=Happy

function Initialize()

   color1Pos=0.2
   color2Pos=0.5
   color3Pos=0.8

end

function Update()

   color1Pos = color1Pos + 0.1
   if color1Pos > 0.8 then color1Pos = 0.0 end
   color2Pos = color2Pos + 0.1
   if color2Pos > 0.8 then color2Pos = 0.0    end
   color3Pos = color3Pos + 0.1
   if color3Pos > 0.8 then color3Pos = 0.0 end
   
end
some how I think I missed something somewhere because I just get the text in a yellow green color with no effects lol
The Lua code must be in a separate text file, in my example called Test.Lua, in the same folder as the skin. You can't just stick the code right in the skin .ini file.
User avatar
Cellinarac
Posts: 50
Joined: May 19th, 2017, 4:03 pm

Re: play and stop audio files

Post by Cellinarac »

ooooh, ok that makes sense LOL
my brain is all over the place right now, working on fixing a laptop, my Fiance keeps bugging me to help her with a game, and doing this between
Post Reply