It is currently March 28th, 2024, 1:28 pm

How to create crawling text?

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:Which one solution did you choose? You removed that option or defined the variable?
we defined the variable, UpdateRateSeconds = 6000
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

Hi ,
I come back with a question:
can the code change, so the text runs a little more inside the skin, now it runs from the edge to the edge?

Thanks

Code: Select all

[Rainmeter]
Author=xenium
Update=100
MouseActionCursor=1
SkinWidth=#SkinWidth#

[Variables]
Speed=3
SkinWidth=160
UpdateRateSeconds=6000

URL=https://www.foreca.com/Japan/Tokyo?tenday
URL1=https://www.foreca.com/Japan/Tokyo

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


[MeasureName]
Measure=Plugin
Plugin=Plugins/WebParser.dll
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1


[image]
meter=image
imagename=Bg.png
x=0
y=0
w=160

[MeterText]
Meter=String
MeasureName=MeasureName
X=(#SkinWidth#-[MeasureX])
Y=5
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
DynamicVariables=1


[MeasureX]
Measure=Calc
Formula=( #Speed# * COUNTER % ( #SkinWidth# + [MeterText:W] ))
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

xenium wrote:can the code change, so the text runs a little more inside the skin, now it runs from the edge to the edge?
Not sure I understand what you mean by "a little more inside the skin". What should have to be the most left and most right position of the string?
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:Not sure I understand what you mean by "a little more inside the skin". What should have to be the most left and most right position of the string?
for example if the skin width = 160, the text runs between 140 and 20. Now it runs between 160 and 0
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

xenium wrote:for example if the skin width = 160, the text runs between 140 and 20. Now it runs between 160 and 0
No actually it runs between 160 and -TextWidth (where obviously TextWidth is the width of the shown string). That's why it goes outside of the skin to left. If we let it to run between 140 and 20 the string will partially goes outside of the skin, to right, but doesn't to left. Your idea would be good only if the width of the skin would be (much) greater then the width of the string.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:No actually it runs between 160 and -TextWidth (where obviously TextWidth is the width of the shown string). That's why it goes outside of the skin to left. If we let it to run between 140 and 20 the string will partially goes outside of the skin, to right, but doesn't to left. Your idea would be good only if the width of the skin would be (much) greater then the width of the string.
ok, thanks for your reply
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

xenium wrote:ok, thanks for your reply
No, no, I didn't say it's impossible. It's not at all (in the meantime I also clarified a few things for myself). And I will do it, but not today, because here is almost midnight and soon I'll go to sleep. But if you can wait, I promise tomorrow a solution.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:No, no, I didn't say it's impossible. It's not at all (in the meantime I also clarified a few things for myself). And I will do it, but not today, because here is almost midnight and soon I'll go to sleep. But if you can wait, I promise tomorrow a solution.
ok thank you, there is no rush
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

Ok, here is a quick solution, which maybe will have to be polished a bit, but at first test it seem to be working.
Define first the Limit variable, in the [Variables] section. This will be the limit of the distance between the string and the edge of the skin:

Code: Select all

[Variables]
...
Limit=20
Now replace the old X option of the [MeterText] meter (X=(#SkinWidth#-[MeasureX])) with the following one: X=[MeasureX].
And finally replace the [MeasureX] measure with this:

Code: Select all

[MeasureX]
Measure=Calc
Formula=( MeasureX + #Speed# )
IfCondition=((#CURRENTSECTION#>=#SkinWidth#-[MeterText:W]-#Limit#)&&(#Speed#>0))
IfTrueAction=[!SetVariable Speed "(-1*#Speed#)"][!UpdateMeasure "#CURRENTSECTION#"]
IfCondition2=((#CURRENTSECTION#<=#Limit#)&&(#Speed#<0))
IfTrueAction2=[!SetVariable Speed "(-1*#Speed#)"][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1
The difference is that this time the string moves in two directions: first to right, then when it reaches its most right position, it turns back and moves to left. Then the process is repeated after the string reaches its most left position.
Please let me know if it is ok or you would like to modify anything.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:Ok, here is a quick solution, which maybe will have to be polished a bit, but at first test it seem to be working.
Define first the Limit variable, in the [Variables] section. This will be the limit of the distance between the string and the edge of the skin:

Code: Select all

[Variables]
...
Limit=20
Now replace the old X option of the [MeterText] meter (X=(#SkinWidth#-[MeasureX])) with the following one: X=[MeasureX].
And finally replace the [MeasureX] measure with this:

Code: Select all

[MeasureX]
Measure=Calc
Formula=( MeasureX + #Speed# )
IfCondition=((#CURRENTSECTION#>=#SkinWidth#-[MeterText:W]-#Limit#)&&(#Speed#>0))
IfTrueAction=[!SetVariable Speed "(-1*#Speed#)"][!UpdateMeasure "#CURRENTSECTION#"]
IfCondition2=((#CURRENTSECTION#<=#Limit#)&&(#Speed#<0))
IfTrueAction2=[!SetVariable Speed "(-1*#Speed#)"][!UpdateMeasure "#CURRENTSECTION#"]
DynamicVariables=1
The difference is that this time the string moves in two directions: first to right, then when it reaches its most right position, it turns back and moves to left. Then the process is repeated after the string reaches its most left position.
Please let me know if it is ok or you would like to modify anything.
this solution is good when the width of the text is small but when the width of the text is larger and does not fit in the width of the skin, it does not work
Post Reply