How to make an sentence auto looping on page load?

Hi could anyone please help me on this? I wana create an effect where on page load this sentence auto looping to the left.

Here are two approaches. Both put a widget with the single line of text in a dynamic panel, named “Content” (with style parameter “Fit to Content” checked on) and then creating an outer dynamic panel, named “Mask” (with its size changed to fit the “viewable area of the text” (or viewport) --this automatically unchecks “Fit to Content”.) You can adjust the timing to suit your needs.

scrolling a line of text.rp (66.1 KB)

The first approach sets all the interactions on “Mask”.

  • There is a Loaded event with an action to “Rotate This by 0 degrees” (which doesn’t actually rotate it but triggers the Rotated event as a kind of built-in function.)
  • The Rotated event moves “Content” to the initial location of (0, 0), waits for 1000 ms, then moves “Content” to [[ -This.width]] with a linear effect over 4000 ms, then waits 5000 ms and rotates itself (thus creating a never-ending, or recursive, loop.)

The second approach creates a different looping effect by duplicating “State 1” of the “Content” dynamic panel, thus creating a copy of the text widget. All the interactions are now on “Content” instead of “Mask”:

  • The Loaded event of “Content” waits 1000 ms then sets the state of itself to Next, sliding left at 8000 ms, wrapping (meaning the last state will transition to the first state), and repeating every 5000 ms.
  • If you change the text, you need to remember to change it in both states of “Content”. You could add an action to Loaded to set the text of “box2” in State2 to the text of “box1” in State1, as long as the box widgets have a preset size instead of “fit to width”.
1 Like

Thank you so much mbc66. it helps a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.