Scripts: Flash :: ActionScript Motions :: Library Article #1

Developer's Section

Create a Simple Motion
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating: 
Average Votes: (1854)
Rate It:   
Favorites:

Simple techniques to create a simple motion in actionscript.

Actionscript is the programming language used to create motions for your .swf animation files. To start with, let's define what an animation is:

What is an animation?
To give life to; fill with life any images you may have.

How can we create an animation?
To make, design, or produce ( a cartoon, for example) so as to create the illusion of motion.

let's create some actionScript code that can represent motions using simple lines:

 Code Snippet 1

init();

function init()
{
    //define x, y points for our object moving

    var movingPoints:Array = new Array();

    for(var u = 0; u < 50; u++)
    {
        movingPoints[u] = new Object();
         
        movingPoints[u].x = Math.random() * Stage.width;
     
        movingPoints[u].y = Math.random() * Stage.height;

    }
    
    lineStyle(1,0,100);

    //now move to the first point

    moveTo(movingPoints[0].x, movingPoints[0].y);


    //and loop through each next successive pair

    for( z = 1; z < movingPoints.length; z+=5)
    {

       //move to the next points

       //1: straight line

       lineTo(movingPoints[z].x, movingPoints[z].y);

       //2:or curve line

       curveTo(movingPoints[z].x, movingPoints[z].y,
               movingPoints[z + 1].x, movingPoints[z + 1].y);

    }  

}


See other Scripts in ActionScript Motions

 

Submit Your Scripts:

If you would like to have your Flash scripts published in this section please fill out
the form below:
*Your Name or
Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]
  

 


© 2018 Erobo Software, Inc. All Rights Reserved. | Read Privacy Notice | RSS