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
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Sun Jul 12, 2009 6:54 am
Hello.
Can anyone tell me how to play an image sequence in Runrev? I have a series of png files I would like to display as a desktop animation with a transparent background.
EDIT:
I found this code in another thread but cannot get it to work.
Code: Select all
local counterVar
on mouseUp
if the hilite of me then
put 0 into counterVar
send "animationRun" to me
end if
end mouseUp
on animationRun
add one to counterVar
if counterVar >= 5 then
put 1 into counterVar
end if
set the icon of button "animated button" to ("animation" & counterVar)
if the hilite of me then
send "animationRun" to me in 0.03 seconds
end if
end animationRun
If someone could look at my stack to see what I have done wrong it would be much appreciated.
http://www.errolgray.com.au/teststack.zip
Many thanks
Bidge
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Sun Jul 12, 2009 9:15 am
Hi Bidge,
I'm not sur this is the best way for animation, but try this
Code: Select all
local counterVar
on mouseUp
set the hilite of the target to not(the hilite of the target)
if the hilite of the target then
put 0 into counterVar
animationRun 1
-- send "animationRun" to me
end if
end mouseUp
on animationRun pWait
repeat until the optionkey is down --••
if the mouse is down and localloc(the screenmouseloc) is within the rect of btn "button" then
exit repeat
end if
add one to counterVar
if counterVar >= 5 then
put 1 into counterVar
end if
put counterVar
put "ball000" & counterVar&".png" into MyImg
set the icon of button "animated button" to the id of img MyImg
wait pWait milliseconds
-- if the hilite of me then
-- send "animationRun" to me in 0.03 seconds
-- end if
end repeat
end animationRun
All the best
Jean-Marc
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Sun Jul 12, 2009 9:20 am
Hi jmburnod
Thanks that worked
Is there another way to play an image sequence?
Many thanks
Bidge
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Sun Jul 12, 2009 10:11 am
Yes,
Depend the context but you can
• change the filename of an image
• move an image
• resize an image
• rotate an image
• change de imagedata and alphadata of an image
• change the points of a polygon
• change the blendlevel of an object
• ...
Best regards
Jean-Marc
-
Klaus
- Posts: 14189
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Jul 12, 2009 10:26 am
Hi Bidge,
I had a look at your stack and here is what I found, but I'm afraid you might not like it!
1. Why do you think that a script that someone posted might immediatley work with your images without any modification?
2. The docs say this about "icon": set the icon of button xyz to {imageID | imageName}
3. The IDs of your images do not fit into this scheme nor do the names of your images
4. The script you posted clearly supposed the names of the images to go from "animation1" to "animation5"
5. Your images are named "balloon0001.png" to "balloon0012.png"
6. The IDs of your images go from 1019 to 1030
So a tiny little bit of thinking would have given you at least a tiny little clue what's wrong, wouldn't it?
Best
Klaus
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Sun Jul 12, 2009 10:32 am
Hi Klaus.
I tried renaming the images to "animation 1" etc.....but stll could'nt get it to work. I'm new to coding and trying my best to learn these things....
Thanks for the advice anyways.
Cheers
Bidge
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Sun Jul 12, 2009 10:35 am
I decided to go with swapping cards rather than playing the image sequence...this seems to be an easier way for me to achieve an animated image sequence
Cheers
Bidge
-
Klaus
- Posts: 14189
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Jul 12, 2009 10:41 am
Hi Bidge,
sorry did not want to sound harsh, so please excuse me if I was!
To rename your images was a good idea and you would have succeeded
if you had omitted the SPACE in the new names
-> "animation1" etc. instead of "animation 1"
OR if you would have changed the script to:
...
set the icon of button "animated button" to ("animation" && counterVar)
## Note the double && which will add an extra SPACE
...
Best
Klaus
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Sun Jul 12, 2009 10:48 am
You were right Klaus! It was that little space that upset the apple cart

No offence at all taken....I apprectiate all your help here
Thanks for those extra tips too

I will try it out again and see how far I can get.
Many thanks again
Cheers
Bidge
-
bn
- VIP Livecode Opensource Backer

- Posts: 4171
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Sun Jul 12, 2009 11:12 pm
Hi bidge,
try this in the button of your stack:
Code: Select all
local counterVar, myIDs, tRun
on mouseUp
if tRun then
put false into tRun
exit mouseUp
end if
put true into tRun
put 0 into counterVar
put "" into myIDs
repeat with i = 1 to the number of images
if the short name of image i contains "ball" then
put the short id of image i & return after myIDs
end if
end repeat
delete last line of myIDs -- last return
send "animationRun" to me
end mouseUp
on animationRun
if the optionkey is down then
put false into tRun
exit animationRun
end if
if tRun then
add one to counterVar
if counterVar >= 12 then
put 1 into counterVar
end if
put line counterVar of myIDs into tID
set the icon of button "animated button" to tID
if "animationRun" is not in the pendingmessages then
send "animationRun" to me in 50 milliseconds -- adjust for speed of animation
end if
end if
end animationRun
to start or stop the animation click on the button. Alternatively you might press the alt key to stop the animation. It checks whether the name of the image contains "ball" and only those images are considered. The way it is now it just looks for the layer of the image (image i ) and does not care about 0001,0002 etc for the sort order of the images.
regards
Bernd
-
bidgeeman
- Posts: 495
- Joined: Wed Feb 21, 2007 7:58 am
Post
by bidgeeman » Mon Jul 13, 2009 1:29 am
Hello Bernd.
That works perfectly thanks for your time. Also thanks jmburnod and Klaus too. It appears there are quite a few ways to play an image sequence in Rev.
Regards
Bidge