View Full Version : animating with actionscript
nickyseven
October 4th, 2005, 10:37 PM
hi there,
i don't often post in the actionscript section even though i'm very experienced in flash, i've been mostly tweening things rather than looking into actionscript to help me out.
i've noticed some sites lately that just have such a smoothness to the animation and i want to work on learning how to do that. for example, this site:
http://www.ronherman.com/index_flash.html
someone told me that in order to get that fluidness to the animation, actionscript is used rather than frame tweening. i've searched and not sure where to start. does anyone have any links that i could look at to try to learn this type of actionscripting? thanks in advance!
nickyseven
TheCanadian
October 4th, 2005, 10:46 PM
As far as I know it would me much easier to manually animate that rather than use ActionScript.
jrda
October 5th, 2005, 12:45 PM
Say you have a moveclip called my_mc:
my_mc._x = 0;
my_mc.onEnterFrame = function()
{
if (this._x < 100)
{
this._x = this._x + 1;
}
}
Fairly easy, no? You can use setInterval or enterFrame loops to generate repeated actions, and then you can change *any* properties of *anything*, or use equations, algorithms, etc. which offer far more interesting things to do than motion tweening.
For example, see my first actionscripted-animation: http://www.creativechannel.net/beta/index.asp made after reading the 3D tutorials on this website (http://www.kirupa.com/developer/actionscript/3dindex.htm). (hint: use the navigation on the left hand side to open the wireframes). Another fun place to start looking is http://www.levitated.net/
The factors that then influence the 'smoothness' of the animation are the framerate / setInterval timer (ie: how often does the page refresh) and the increments of your animation (ie: how many pixels do you jump each frame).
The smoother your animation, the more the processor load. ie: refreshing the page 40 times a second carries takes far more graphics processing than refreshing it 12 times a second. Which is possibly why motion-tweens veer towards jumpy (although I have no idea what the code behind them actually is).
You'll also get ideas from looking in the actionscript docs for moveTo() lineTo() lineStyle() beginFill() and mask layers. The first can be used to draw things (lines and shapes). Then set your shapes to be in mask layers and you can do all sorts of crazy stuff - like animate video content...
Haig Larsen
October 5th, 2005, 12:57 PM
I think one thing beginners should definitely do to make their animations look "smoother" is up their frame rate. The default 12 is fine for some things, I'm sure, but I've never found it satisfactory. Try experimenting. Changing to 24-30fps is a great, simple way to make things animate more smoothly.
-Haig
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.