It is currently April 19th, 2024, 7:39 am

Simple Text Marquee

Tips and Tricks from the Rainmeter Community
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Simple Text Marquee

Post by raiguard »

simplemarquee.gif
A simple, dynamic text marquee method. It will automatically marquee any length of text, with adjustable animation rate, start and end wait intervals, and text contents. It will automatically not marquee if the text is narrower than the container it is placed in.

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!Refresh]
OnRefreshAction=[!CommandMeasure MeasureActionTimer "Execute 1"][!CommandMeasure MeasureActionTimer "Execute 2"][!CommandMeasure MeasureActionTimer "Execute 3"]
AccurateText=1

[Variables]
; Text settings
text1=This is a long text testy
text2=This is an even loooooooooonger text testy
text3=Too short testy!
; Marquee settings
animationSpeed=32
marqueeBeginWait=1500
marqueeEndWait=1500
; Dynamic variables - do not change
marquee1=0
marquee2=0
marquee3=0

[StyleText]
FontFace=Calibri
FontColor=230,230,230
FontSize=15
FontWeight=600
X=0
Y=1R
Antialias=1
Container=MeterTextContainer
DynamicVariables=1

[MeasureMarquee1Offset]
Measure=Calc
Formula=max(0,([MeterText1:W] - [MeterTextContainer:W]))
DynamicVariables=1

[MeasureMarquee2Offset]
Measure=Calc
Formula=max(0,([MeterText2:W] - [MeterTextContainer:W]))
DynamicVariables=1

[MeasureMarquee3Offset]
Measure=Calc
Formula=max(0,([MeterText3:W] - [MeterTextContainer:W]))
DynamicVariables=1

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
; Marquee 1
ActionList1=Repeat Move1,#animationSpeed#,[MeasureMarquee1Offset:] | Wait #marqueeEndWait# | Reset1 | Wait #marqueeBeginWait# | DoOver1
Reset1=[!SetVariable marquee1 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText1][!Redraw]
Move1=[!SetVariable marquee1 "(#marquee1# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText1][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Execute 1"]
; Marquee 2
ActionList2=Repeat Move2,#animationSpeed#,[MeasureMarquee2Offset:] | Wait #marqueeEndWait# | Reset2 | Wait #marqueeBeginWait# | DoOver2
Reset2=[!SetVariable marquee2 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText2][!Redraw]
Move2=[!SetVariable marquee2 "(#marquee2# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText2][!Redraw]
DoOver2=[!CommandMeasure MeasureActionTimer "Execute 2"]
; Marquee 3
ActionList3=Repeat Move3,#animationSpeed#,[MeasureMarquee3Offset:] | Wait #marqueeEndWait# | Reset3 | Wait #marqueeBeginWait# | DoOver3
Reset3=[!SetVariable marquee3 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText3][!Redraw]
Move3=[!SetVariable marquee3 "(#marquee3# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText3][!Redraw]
DoOver3=[!CommandMeasure MeasureActionTimer "Execute 3"]
DynamicVariables=1

[MeterBackground]
Meter=Shape
Shape=Rectangle 1,1,180,106,6 | StrokeWidth 2 | Stroke Color 50,50,50 | Fill Color 15,15,15

[MeterTextContainer]
Meter=Image
SolidColor=255,255,255,255
X=16
Y=16
W=150
H=76

[MeterText1]
Meter=String
MeterStyle=StyleText
X=#marquee1#
Y=1
Text=#text1#

[MeterText2]
Meter=String
MeterStyle=StyleText
X=#marquee2#
Text=#text2#

[MeterText3]
Meter=String
MeterStyle=StyleText
X=#marquee3#
Text=#text3#
You do not have the required permissions to view the files attached to this post.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
XAS.Prime
Posts: 1
Joined: May 1st, 2022, 1:41 am

Re: Simple Text Marquee

Post by XAS.Prime »

Rainmeter noob here. I know you did this a while ago but you rock 💯 Thanks for this.
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Simple Text Marquee

Post by LuciferVisuals »

raiguard wrote: March 19th, 2019, 8:34 pm simplemarquee.gif
A simple, dynamic text marquee method. It will automatically marquee any length of text, with adjustable animation rate, start and end wait intervals, and text contents. It will automatically not marquee if the text is narrower than the container it is placed in.
Cool 8-)

Any chance you know of something equally simple that could create vertically scrolling text, like the credits at the end of a film?

Keith
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple Text Marquee

Post by Yincognito »

LuciferVisuals wrote: April 30th, 2023, 2:08 pmAny chance you know of something equally simple that could create vertically scrolling text, like the credits at the end of a film?
The principle is the same, it's just a matter of using :H where :W was used, and use the #marrquee...# variables in the Y options instead of the X ones.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Simple Text Marquee

Post by LuciferVisuals »

Yincognito wrote: April 30th, 2023, 10:09 pm The principle is the same, it's just a matter of using :H where :W was used, and use the #marrquee...# variables in the Y options instead of the X ones.
Thank you so much, I thought I would ask first this time, before re-inventing the wheel. BTW this is for the actual credits that will follow the star wars text, I wanted something quick and easy for this. as it's quite possible no-one will ever bother to actually read them..... LOL

But wanted something that was like the credits at the end of a film, that I could just add to as things progress without a lot of work updating it.

keith
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple Text Marquee

Post by Yincognito »

LuciferVisuals wrote: May 1st, 2023, 7:56 amas it's quite possible no-one will ever bother to actually read them.....
Doesn't matter, the effect is still nice to have, and it will be useful to you for other similar approaches. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Simple Text Marquee

Post by LuciferVisuals »

Yincognito wrote: May 1st, 2023, 9:09 am Doesn't matter, the effect is still nice to have, and it will be useful to you for other similar approaches. ;-)
Exactly, and the main thing is I wanted to do it................. I actually doubt if it's been done before, (but I would'n be surprised or disappointed if it has, I HAVEN'T DONE IT BEFORE) ... Or rather hadn't.

If you have time take a look let me know what you think.

Keith
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple Text Marquee

Post by Yincognito »

LuciferVisuals wrote: May 1st, 2023, 5:02 pmI actually doubt if it's been done before, (but I would'n be surprised or disappointed if it has, I HAVEN'T DONE IT BEFORE) ... Or rather hadn't.

If you have time take a look let me know what you think.
Don't know about vertical marquees, but I do horizontal ones in 3 skins from my suite (I did consider vertical ones too, but decided otherwise for design and fluency purposes). I use a fast skin update though, not an ActionTimer measure - that, along with the fact that mine is endless, are the only differences compared to the approach presented here.

Take a look where? Cause I already pointed out what should be done to switch from horizontal to vertical above. Unless I missed something, of course, which is a (unlikely, but still) possibility.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Simple Text Marquee

Post by LuciferVisuals »

Yincognito wrote: May 1st, 2023, 5:41 pm Take a look where? Cause I already pointed out what should be done to switch from horizontal to vertical above. Unless I missed something, of course, which is a (unlikely, but still) possibility.
I meant take a look at the code and images I sent, for my twinkling star field effect, and my revised star wars text, optional of course, but I thought you would like to see it and wondered what you thought?

Coming back to the vertical scrolling text. I am trying to superimpose a file called Credits.ini, (vertical scrolling text 3D text) over the star wars, scroll as it finishes, (because they wont play together), I have managed to do that ok, using the code below. But I'm having difficulty anchoring the new files position in relation to the first file (the star wars one).

Code: Select all


[ImageNumberCalc]
Measure=Loop
StartValue=0
EndValue=203
Increment=1
LoopCount=1
IfCondition=(#CURRENTSECTION#>=203)
IfTrueAction=[!DisableMeasure "#CURRENTSECTION#"][!ActivateConfig "Stargates\Credits" "Credits.ini"][!SetAnchor "100" "100" "Stargates\Credits" "Credits.ini" ][!ZPos "2" "Stargates\Credits" "Credits.ini"]  [!Redraw]
Any help you could offer would be greatly appreciated.

Keith
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple Text Marquee

Post by Yincognito »

LuciferVisuals wrote: May 1st, 2023, 6:27 pmBut I'm having difficulty anchoring the new files position in relation to the first file (the star wars one). Any help you could offer would be greatly appreciated.
Not sure if it's the best way to do it, but since you said it works, let's go with it. The position and dimensions of the current skin (I'm guessing, this is the star wars one, according to your description) can be obtained via CURRENTCONFIG built-in variables. So, it would probably be something like:

Code: Select all

[!SetWindowPosition (#CURRENTCONFIGX#) (#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#) "Stargates\Credits"]
The above "should" position the credits right under the current skin, presumably the star wars one. Check the manual to see the right syntax of !SetWindowPosition, because it takes the config name as parameter, not the file itself. The measure where you have these current config positions and dimensions should have DynamicVariables=1 added to it, so that these dynamic variables can be "seen" properly.

P.S. The anchor only needs modification if you want to change the reference point in the skin that is represented by the window position. I'm guessing that you don't want to set the anchor to another point than the top left corner of the credits skin, so such an anchor change shouldn't be necessary.

EDIT: On a second thought, I'm thinking that using the !Move bang instead of setting the window position might be a better idea. Like:

Code: Select all

[!Move (#CURRENTCONFIGX#) (#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#) "Stargates\Credits"]
This assumes the said config is already activated, of course.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth