Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Motion - Line pivoting in circle 3

Status
Not open for further replies.

esearing

IS-IT--Management
Aug 22, 2000
132
US
Newbie question.
Can anyone tell me how to make a line pivot in a circle like a hand on a watch? I also want to constantly increase the speed of the circular path.

Eric

Starting GA/AL Focus User Group (FUSE) in Atlanta. See IBI website for usergroup info or contact me at eric.searing@wcom.com.
 
There are two ways to do this - one easy, one hard. The hard one involves trigonometry and quite a bit of scripting so let's leave it for now :) .

The easy one just needs a bit of set up and a few lines of script.

You'll need a "circle" graphic symbol as a background layer and a "line" movieClip in the layer above. When you draw the line in your movie clip draw it as a vertical "12 o'clock" position and make sure that the bottom end of the line is stage centre (it should touch the crosshair in the middle of the screen).

Line up the two symbols on the main stage so that it looks like your "clock".

Attach this script to the line clip...

//move the line every frame of the movie
onClipEvent (enterFrame) {

//change the rotation of the line clip
_rotation += int(speed);

//increase the speed of the rotation

//only increase it by .1 at a time or else it speeds up so fast you never see the acceleration.

//The "int" in the line above rounds the decimal places off

speed += 0.1;

//the motion can appear jerky - this smooths it out a bit
updateAfterEvent();
}


If you have problems making this work I can mail you the .fla
 
nice!!
e.gif


carlsatterwhite@endangeredgraphics.com
 
That did the trick except that the line spins from its center rather than pivots from the center of the circle.
I tried Modify Edit Center (of the line) with no luck. Eric

Starting GA/AL Focus User Group (FUSE) in Atlanta. See IBI website for usergroup info or contact me at eric.searing@wcom.com.
 
Sounds like you've positioned the line in the stage centre of its movie clip. What you need to do is position the bottom tip of the line in the centre of the stage: the _rotation property is calculated from the centre of the clip, if you position it right the "hand" will revolve around the centre (i.e. its own base) and give you your effect.
 
Got it! Many Thanks. Eric

Starting GA/AL Focus User Group (FUSE) in Atlanta. See IBI website for usergroup info or contact me at eric.searing@wcom.com.
 
Should have checked to see if you'd replied before I posted that last one! :)
 
double-click the line movie-clip, select the line, hit CTRL+I and insert the co-ordinates 0 for x-position and 0 for y-position, making sure that corner positioning is selected.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top