Many ways to animate

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3618
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Many ways to animate

Post by richmond62 » Sun Apr 24, 2016 4:24 pm

A problem associated with both stacks #7 and #8 is that if one keeps one's arrow keys down, instead of "punctuating" them,
one ends up with multiple animations that interfere with other arrowKeyDowns subsequently.
Well . . . here we are at last . . .

I've just invented a custom property called "keyFiredOnce" and it can be used like this:

on rawKeyDown RKD
if the keyFiredOnce of this card = "true" then
do all sorts of interesting things
end if
set the keyFiredOnce of this card to "false"
end rawKeyDown

on rawKeyUp RKU
set the keyFiredOnce of this card to "false"
end rawKeyUp

Presumably this won't work with "arrowKey" as there are no options for 'up' and down'
so one will have to call the arrow keys by their unicode addresses:

left arrow key = 65361
right arrow key = 65363
up arrow key = 65362
down arrow key = 65361

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3618
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Many ways to animate

Post by richmond62 » Sun Apr 24, 2016 4:52 pm

Here's the eleventh stack, which has a quite considerably rewritten cardScript.
ANIM11.jpg
https://www.dropbox.com/s/uvt4cgzoeymic ... e.zip?dl=0

Rauterkus
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 33
Joined: Fri Apr 14, 2006 8:12 pm
Location: Pittsburgh, PA, USA
Contact:

Re: Many ways to animate

Post by Rauterkus » Wed Apr 27, 2016 2:11 pm

This is a fantastic thread and very valuable for something we hope to do with our pending grant in Pittsburgh.

Thanks for the great examples. I also am making a note here to myself to check the user-list archives as well as there has been some valued content tossed in that space in this topic too.

The was just posted, for example, from another Mark.

Subject: Re: Being silly with penguins

Sorry, I joined this thread late. I did something like this in 2003, and it worked great, and I used an animated gif for the animation.

Checkout the built-in property ?the repeatcount? in the dictionary.
Then, then set the icon of your button to the animated gif (hide the gif somewhere).
Then, the button script is as trivial as

on Mousedown
set the repeatCount of image "runningMan" to -1
?the gif will now run continuously
set the uAllowMove of me to true
?this is only if you want to turn the moving ability of the button to on/off
end MouseDown

on mouseMove x,y
if not the uAllowMove of me then exit mouseMove

set the loc of me to (max(35,min(zaWide,x))),(max(35,min(zaHigh,y)))
?zaWide and zaHigh are the width and height of the stack, keeps the button on the page, so you don?t lose it
end mouseMove

on MouseUp
set the uAllowMove of me to empty
set the repeatCount of image "runningMan" to 0
?this stops the animation
do other stuff
? e.g. check to see if they have moved the button to the right place

end Mouseup

This worked very well (totally smooth dragging and animation) on the processors available in 2003.
I just checked it again on LC 7.1, and it still seems to work fine.
Hope that helps!

Best,

Mark Mitchell


===
Bravo to all animation hackers and hacks. Keep them flowing!

Ta.

Mark Rauterkus, mark-at-rauterkus-dot-com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3618
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Many ways to animate

Post by richmond62 » Sat Apr 30, 2016 11:21 am

I am a bit anti animated GIFs as they really are extremely variable in quality, while a sequence of images
(whether JPG, PNG or GIF) displayed inside a graphic object can be of as high quality as one wants
without those odd artefacts that seem to get into a lot of animated GIF images.

As "secs" can cope with fractions, as in:

wait 0.0035 secs

one can play around with sinusoidal movement and so on to one's
heart's content inside graphic objects.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3618
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Many ways to animate

Post by richmond62 » Sat Jul 02, 2016 7:48 pm

Just cross referencing to here: http://forums.livecode.com/viewtopic.ph ... 76#p144256

as there is some stuff about animation there.

Post Reply

Return to “Rich Media”