It is currently November 21st, 2018, 3:06 pm

Running string

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

Re: Running string

balala » August 13th, 2015, 4:28 pm

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

drakulaboy » August 21st, 2015, 6:35 pm

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

Re: Running string

balala » August 21st, 2015, 7:20 pm

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