animated images

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rushvan
Posts: 10
Joined: Mon Oct 15, 2007 8:50 pm

animated images

Post by rushvan » Tue Oct 23, 2007 4:54 am

i have an animated section that i want to move across the screen. i can move the still image but don't know how to load an animated image.

it's a man walking.

Klaus
Posts: 14188
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Oct 23, 2007 11:30 am

Hi rushvan,

is this a series of still images?
If not what format is your animation?


Regards

Klaus

rushvan
Posts: 10
Joined: Mon Oct 15, 2007 8:50 pm

animated images

Post by rushvan » Tue Oct 23, 2007 7:44 pm

i have successfully animated a series of a man walking by using a button script 'go to card x then go to card x2' etc. thse are jpegs. on indivual cards.

but i want have an image run through a series x ,x2 etc and then script 'move image such a place to such a place'. i don't know how to load a series so one image can be animated.

i can move a single still image just fine.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Oct 23, 2007 8:21 pm

Hi rushvan,

Suppose that you have 4 images, with id numbers 12000 to 12003. Make a button and set its icon to 12000. You can make the animation run with the following button script.

Code: Select all

on playAnim
  if the icon of me < 12000 or the icon of me > 12002 then
    set the icon of me to 12000
  else
    set the icon of me to (the icon of me + 1)
  end if
  if the cPlay of me is true then
    send "playAnim" to me in 200 millisecs
  end if
end playAnim
To start the animation, make a second button, with the following script.

Code: Select all

on mouseUp
  if the cPlay of btn 1 is true then
    set the cPlay of btn 1 to false
  else
    set the cPlay of btn 1 to true
    send "playAnim" to btn 1
  end if
end mouseUp
Once you have this running, it is simple to make the button move:

Code: Select all

move button 1 from 100,100 to 400,550 in 10 secs
You could add above line to the mouseUp handler. This moves the button from point 100,100 to point 400,550 in 10 seconds without stopping the animation.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rushvan
Posts: 10
Joined: Mon Oct 15, 2007 8:50 pm

animated images

Post by rushvan » Wed Oct 24, 2007 2:20 am

thanx y'all...mark i'll try your tip. what i am trying is this.

images (not cards x.x2.x3 etc). make a button. script 'move image x fromsuch to such', 'move image x2 for such to such' etc.

so far no good..what do you think?

Post Reply