It is currently April 20th, 2024, 10:55 am

Running string

Tips and Tricks from the Rainmeter Community
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running string

Post by balala »

Because the last code posted above is almost three years old and in the meantime Rainmeter got a lot of improvements (and I also accumulated a lot of experience), I totaly rebuilt the code:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
Update=100
MouseActionCursor=1

[Variables]
Txt=Naruto Desktop
Speed=1

;----------------------------------------

[TextStyle]
FontSize=16
FontFace=Stagnation BRK
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
Text=#Txt#

[MeterText]
Meter=String
MeterStyle=TextStyle
X=[MeasureX]
Y=0
W=[BinActionWidth]
H=[MeasureTextWidth:H]
FontColor=0,0,0
FontEffectColor=255,255,255
DynamicVariables=1

[MeasureTextWidth]
Meter=String
MeterStyle=TextStyle
X=0
Y=0
FontColor=0,0,0,0
SolidColor=0,0,0,1
FontEffectColor=255,255,255,0

[MeasureTimer]
Measure=Calc
Formula=(( MeasureTimer + #Speed# ) % ( 2 * [MeasureTextWidth:W] ))
DynamicVariables=1

[MeasureX]
Measure=Calc
Formula=( MeasureTimer - [MeasureTextWidth:W] )
DynamicVariables=1

[BinActionWidth]
Measure=Calc
Formula=(( MeasureX > 0 ) ? ( [MeasureTextWidth:W] - MeasureX ) : [MeasureTextWidth:W] )
DynamicVariables=1
This code don't need the TextWidth and SkinWidth variables, it determins them automaticaly. But now I added a Speed variable, which controls the speed of the string.
Please let me know if this code match your needs.
You do not have the required permissions to view the files attached to this post.
drakulaboy
Posts: 165
Joined: June 29th, 2014, 8:35 pm

Re: Running string

Post by drakulaboy »

awesome balala, add AverageSize to have some smooth letter move? ;-)
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running string

Post by balala »

Yes, you can try to see what's happening.