Page 1 of 1

Animate text

Posted: Fri Jun 21, 2013 9:00 pm
by Tester2
Fellow Coders,

If I want to "scroll" some text right to left across a field - picture like a "...Live Broadcast..." message going across a screen - is this doable?

If so, please share how to code this or help point me in the right direction.

Thanks so much!

Re: Animate text

Posted: Sat Jun 22, 2013 4:13 am
by Simon
Sure it's doable! :)
LiveCode is super cool

Code: Select all

on mouseUp
   put "This is a scrolling newsbanner" into tText
   put tText into fld 1
   set the left of fld 1 to the right of this cd
   set width of fld 1 to the formattedWidth of fld 1
   goScroll
end mouseUp

on goScroll
   set the left of fld 1 to (the left of fld 1 - 1)
   if the right of fld 1 < the left of this cd then
      set the left of fld 1 to the right of this cd
   end if
   send goScroll to me in 10 milliseconds
end goScroll
I'm sure that could be better...

Simon

Re: Animate text

Posted: Sat Jun 22, 2013 6:11 pm
by jacque
Here's a way to do it that moves the text but doesn't move the field. Put enough spaces before the actual text so that it's out of bounds when the scrolling first starts.

Code: Select all

on mouseUp
  put "                                    This is a scrolling newsbanner." into tText -- add spaces at front for wider fields
  put tText into fld 1
  goScroll
end mouseUp

on goScroll
  put char 1 of fld 1 after fld 1
  delete char 1 of fld 1
  if the shiftkey is not down then
    send goScroll to me in 50 milliseconds
  end if
end goScroll