So, here is the skin:
Code: Select all
[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string
[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1
[Variables]
TextWidth=45
SkinWidth=100
Txt=Hello
;----------------------------------------
[MeterText]
Meter=String
X=[MeasureX]
Y=3
W=[BinActionWidth]
H=25
FontColor=200,200,200
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Txt#
Hidden=1
DynamicVariables=1
[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )
[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))
[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )
[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
- Use a short update, I used 100. If not, the movement will not be smoth enough.
- TextWidth and SkinWidth are the width of the text and skin. Since I didn't used a background the last one must be setted. Setting SkinWidth is simple: it depend on you. Setting TextWidth determines the amount of pause betwean exit and reentry of the string: if you find the real width of the string (in pixels) immediately after the string goes out on left, it will strat to enter on the right.
- The [MeasureTimer] section is a counter which is increasing at every update.
- Acording to it's value, the [MeasureX] value will define the string's position. If the string isn't completely out from the skin's width, then it's position moves at left at every update. In other case it become double of skin's total width, because in this case the string went out from the skin and the whole process must be reseted (by [BinActionRefresh] section).
- The width of the visible part of the string will be determined by [BinActionWidth] section. Near the margins this width must be increase (when the string enter) and decrease (when it goes out).
The great inconvenient of this skin is that must be determined the more accurately the width of the text. I couldn't find a better way.
Please post comments about how this skin works for you and if you find it good enough or if you can improve it. Any comment would be welcomed.