Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-15-2005, 09:46 AM   #1
Oli-G
Member
 
Join Date: May 2005
Posts: 62
Default Spinning a movie clip on center axis? (and more)

Hey fellas,

I have a movie clip on the stage, which is a record.

What I want, is for the user to be able to move the mouse over, click down, and spin the record left and right. To confuse matters, I would like to keep the record spinning (tapering to a stop) after they let go and flick the cursor across the screen. So if they hold the mouse down, the record will rotate with the mouse. and perhaps some lag which will be easy enough.

Anyone know how to do this? I also need to set a maximum velocity (?), whereby when it is spun hard enough, an event is triggered.

I guess the most essential thing is to be able to rotate the object, with tapering etc being secondary. I'm told it uses fairly simple pythagoras etc, but i'm yet to even use a simple rotate command.

My teacher did send a good detailed example, but I had a fair bit of difficulty making heads or tails given that there were rotation limits imposed, etc

Any ideas? cheers
Oli-G is offline   Reply With Quote
Old 05-15-2005, 11:47 AM   #2
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

I am not sure I know how to do everything your asking, but here is some rotation code I used, it might get you started. I used a movie clip with the instance name of "cd".
ActionScript Code:
cd.onEnterFrame = function (){     this._rotation -=30; //sets the rotation of the movie clip     //trace(this._x);     // this moves the movie clip 25 pixels to the left     //if(this._x>100) {         //this._x-=50     //}  }
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 05-15-2005, 11:58 AM   #3
Oli-G
Member
 
Join Date: May 2005
Posts: 62
Default

Hey dude,

Thanks for the reply. I threw the code in though and the record was spinnin all over the place! At least it was movin tho eh .

Basically I need it to act kinda similar to say, a volume knob, on a synth, in regards to how the user can interact with it. The other stuff will be seperate, I guess.
Oli-G is offline   Reply With Quote
Old 05-15-2005, 03:26 PM   #4
Oli-G
Member
 
Join Date: May 2005
Posts: 62
Default

Well, the general consensus on other forums is that this is gonna be a bit over my head, so i'm changing it.

What I now would like is, when the record is just clicked, to spin by itself, and gradually increase until it hits a top speed, where an event is triggered.

Any ideas?

cheers!
Oli-G is offline   Reply With Quote
Old 05-15-2005, 07:57 PM   #5
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

Try this and let me know what your think. You can adjust the rotation speed by increasing the rotation value or slow it down as the case may be.
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 05-15-2005, 08:35 PM   #6
pungkerton
Registered User
 
pungkerton's Avatar
 
Join Date: May 2005
Posts: 51
Default

Maybe something like this:

ActionScript Code:
onClipEvent( enterFrame ){     if( rotateSpeed == ( undefined || null ) ){         _global.rotateSpeed = 1;     } else {         if( rotateSpeed < 30 ){             _global.rotateSpeed++;         }     }     this._rotation = this._rotation + rotateSpeed; }

30 is the maxspeed.
the increment to speed up is 1; for more, change _global.rotateSpeed++; to _global.rotateSpeed = _global.rotateSpeed + n;.
I dropped this onto the movieclip rather than the frame.
pungkerton is offline   Reply With Quote
Old 05-15-2005, 08:49 PM   #7
pungkerton
Registered User
 
pungkerton's Avatar
 
Join Date: May 2005
Posts: 51
Default

Here's what I came up with...
Attached Files
File Type: zip record.zip (7.5 KB, 284 views)
pungkerton is offline   Reply With Quote
Old 05-15-2005, 09:31 PM   #8
Oli-G
Member
 
Join Date: May 2005
Posts: 62
Default

Great work guys, very much appreciated.

Last edited by Oli-G; 05-16-2005 at 06:09 AM.
Oli-G is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:49 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.