Animating images at different speeds
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Animating images at different speeds
Pretty primitive, but as I knocked the whole thing together in 15 minutes
you shouldn't expect more.
https://www.dropbox.com/s/p986vkztrx1g5 ... a.zip?dl=0
mess around with the right and left arrow keys.
you shouldn't expect more.
https://www.dropbox.com/s/p986vkztrx1g5 ... a.zip?dl=0
mess around with the right and left arrow keys.
Re: Animating images at different speeds
A nice start. If you were looking to produce an actual parallax effect, this is usually achieved by objects closest to the viewer moving faster than objects farther from the viewer. So consider switching the rates you're using on the cloud and figure images.
I uploaded a modified version of your stack that does the above, along with some other improvements, such as smoother motion by using "send in..." instead of the repeating arrowkey message, using a single foreground image instead of 2, and others that can be seen in the sample. There's some math that could be done to calculate real parallax but a simple percentage is used here to make the clouds move slower than the figure.
In your message box: go url "http://tactilemedia.com/download/Garuda2.livecode"
(Click the stack after it downloads to switch focus to the stack so you can use your arrowkeys.)
Hope this is useful.
I uploaded a modified version of your stack that does the above, along with some other improvements, such as smoother motion by using "send in..." instead of the repeating arrowkey message, using a single foreground image instead of 2, and others that can be seen in the sample. There's some math that could be done to calculate real parallax but a simple percentage is used here to make the clouds move slower than the figure.
In your message box: go url "http://tactilemedia.com/download/Garuda2.livecode"
(Click the stack after it downloads to switch focus to the stack so you can use your arrowkeys.)
Hope this is useful.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
Here's an animated GIF being made to move around a card.
- Attachments
-
- AnimatedGIFtest.zip
- (70.54 KiB) Downloaded 353 times
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
Thanks to the good offices of Brahmanathaswami and GIMP I have removed the annoying surrounding round one
of the frames in the Tiger animated GIF.
So, here is a modified version of the previous stack featuring 2 animated tigers.
My "problem" is how to get them to animate at the same time.
of the frames in the Tiger animated GIF.
So, here is a modified version of the previous stack featuring 2 animated tigers.
My "problem" is how to get them to animate at the same time.
- Attachments
-
- AnimatedGIFtest.zip
- New version
- (90.61 KiB) Downloaded 335 times
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Animating images at different speeds
put this into button "animate"
set the script of img "Tiger" to
set the script of img "TigerBack" to
Kind regards
Bernd
Code: Select all
on mouseUp
set the vis of img "Tiger" to true
set the repeatCount of img "Tiger" to -1 -- start GIF animation in endless repeat loop
set the vis of img "TigerBack" to true
set the repeatCount of img "TigerBack" to -1
set the moveSpeed to 50
move img "Tiger" from -59, 240 to 698, 240 without waiting
move img "TigerBack" from 698, 160 to -59, 160 without waiting
end mouseUp
Code: Select all
on moveStopped
set the repeatCount of me to 0 -- stops GIF-animation
set the left of me to the left of this card
end moveStopped
Code: Select all
on moveStopped
set the repeatCount of me to 0
set the right of me to the right of this card
end moveStopped
Bernd
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
More "silly" stuff.
Here's a stack containing an extremely crude animated GIF I made in about 10 minutes using GIMP:
and I am attaching both the stack and the individual frames, so that anyone who wants can download
GIMP: https://www.gimp.org/downloads/
and try their hand at assembling the frames into an animated GIF.
Here's a stack containing an extremely crude animated GIF I made in about 10 minutes using GIMP:
and I am attaching both the stack and the individual frames, so that anyone who wants can download
GIMP: https://www.gimp.org/downloads/
and try their hand at assembling the frames into an animated GIF.
- Attachments
-
- wavingManFrames.zip
- The individual frames from the animated GIF
- (9.74 KiB) Downloaded 324 times
-
- tenMinutesWork.livecode.zip
- Stack
- (4.36 KiB) Downloaded 321 times
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
Here's my, extremely simple, way of animating 2 GIF images simultaneously:
- Attachments
-
- AnimatedGIFtest2.zip
- Stack with simultaneous animation.
- (90.7 KiB) Downloaded 333 times
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
Someone wrote an animated GIF generator in SuperCard:
http://forums.supercard.us/viewtopic.ph ... 1353#p6607
I wonder if one could "steal" and/or adapt it for LiveCode?
I'm going to download the SuperCard time-limited Demo onto my G5 Mac and see what I can see.
http://forums.supercard.us/viewtopic.ph ... 1353#p6607
I wonder if one could "steal" and/or adapt it for LiveCode?
I'm going to download the SuperCard time-limited Demo onto my G5 Mac and see what I can see.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Animating images at different speeds
The post suggests it uses SC only as a wrapper to a command-line tool, Gifsicle, available here:richmond62 wrote:Someone wrote an animated GIF generator in SuperCard:
http://forums.supercard.us/viewtopic.ph ... 1353#p6607
I wonder if one could "steal" and/or adapt it for LiveCode?
http://www.lcdf.org/gifsicle/index.html
I would imagine it should be quite easy to call Gifsicle from LC.
FWIW, while this code isn't open source, Ken Ray wrote routines to create animated GIFs directly in LiveCode, taking advantage of LC's many useful binary operations:
http://www.stykz.net/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
The snags about Stykz are two-fold:
1. It only generates very primitive animated GIFs (mainly stick figure ones).
2. There is no Linux version.
1. It only generates very primitive animated GIFs (mainly stick figure ones).
2. There is no Linux version.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Animating images at different speeds
Yes, stick figure animation is exactly what Stykz does.
If one were inclined to make a general-purpose animation toolkit in LiveCode, Ken's work shows that the foundational elements for such a (rather large) task are indeed possible.
He made Stykz in his spare time for his son, and gives the software away at no cost. I can hardly blame him if he hasn't had the time to finish the Linux port.
If one were inclined to make a general-purpose animation toolkit in LiveCode, Ken's work shows that the foundational elements for such a (rather large) task are indeed possible.
He made Stykz in his spare time for his son, and gives the software away at no cost. I can hardly blame him if he hasn't had the time to finish the Linux port.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
I think Stykz is very good at what it does.
The reason I mentioned Gifsicle was because I think that
a LiveCode-based tool that would allow one to assemble
all types of animated GIFs would be a great plus.
The reason I mentioned Gifsicle was because I think that
a LiveCode-based tool that would allow one to assemble
all types of animated GIFs would be a great plus.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Animating images at different speeds
Here's an animated GIF travelling along a path:
The path is on a lower layer than the grass image
so it is hidden.
The path is on a lower layer than the grass image
so it is hidden.
- Attachments
-
- Path.zip
- (84.32 KiB) Downloaded 336 times
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Animating images at different speeds
With LC's shell function it should be pretty straightforward to build a GUI for Gifsicle.richmond62 wrote:I think Stykz is very good at what it does.
The reason I mentioned Gifsicle was because I think that
a LiveCode-based tool that would allow one to assemble
all types of animated GIFs would be a great plus.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn