PDA

View Full Version : rotating menu



Lippuzz_
April 7th, 2005, 06:04 AM
i want to make this menu which a part of it rotates. I have a circle with text besides it. This are the buttons. On this circle i have some kinda thing which points the button of where the users mouse is on. So each time the users chooses anothe button, the pointer has to rotate to that button. If there is no mouseover or anything, the pointer has to point the button on where the user is on the site (so in home the point has to point to home button)
anybody who can help me?

scotty
April 7th, 2005, 07:22 AM
Check this
http://www.kirupa.com/forum/showthread.php?t=89014

scotty(-:

Lippuzz_
April 7th, 2005, 08:23 AM
thanks, but no thanks. It nothing i can use...

mikkomikko
April 7th, 2005, 11:10 AM
don't really know what you mean, but is it at all anything like this

Lippuzz_
April 7th, 2005, 11:37 AM
no, this is not what i mean..

in the first place the rotation should animated. I couldn't find anything on the internet so do not have anything to compare with. i will post a pic, maybe things will be clear than...
the triangle should rotate from the middel en which button is between the space of the triangles should be light up or something

mikkomikko
April 7th, 2005, 12:21 PM
The animation would be easy to add. :D


the triangle should rotate from the middel en which button is between the space of the triangles should be light up or something
Still don't understand what how it shoul work, sorry, i'm so stupid. :trout:

Lippuzz_
April 7th, 2005, 06:41 PM
like the possition now, the tint of home should be drop down to 0 so the MC get's his full color

mikkomikko
April 7th, 2005, 06:49 PM
count the angle of the buttons relative to the center of the rotating thing and tell it to rotate to that position with _rotation value.

check. http://www.actionscript.org/tutorials/advan...d_flash/index2.shtml (http://www.actionscript.org/tutorials/advanced/trigonometry_and_flash/index2.shtml)

Lippuzz_
April 8th, 2005, 04:33 AM
thanks! this is something i was looking for!

Lippuzz_
April 8th, 2005, 05:23 AM
any thoughts about to make this an animation? The code works, but it want a smooth rotation. something with a for loop or anything?

mikkomikko
April 8th, 2005, 05:54 AM
Use onEnterFrame thing with the rotating this. Like

rotatingThing.onEnterFrame = function () {
this._rotation = targetRotation - (targetRotation - this._rotation)*0.9;
}
Change the multiplyer at the end and see what happens. Read more from
actionscript.org (http://www.actionscript.org/tutorials/intermediate/actionscripted_movement/index.shtml)
and
webmonkey (http://webmonkey.wired.com/webmonkey/03/27/index3a.html?tw=multimedia)

Lippuzz_
April 8th, 2005, 11:18 AM
thanks, i found out how i can rotate this thing.



onClipEvent (enterFrame) {
trace(this._y +" = y")
trace(this._x +" = x")
rotate=0;
if (_root._xmouse > (this._x+20) && _root._xmouse < (this._x +150) && _root._ymouse < (this._y +150) && _root._ymouse > (this._y -150)) {
Radians = Math.atan2((_root._ymouse-this._y), (_root._xmouse-this._x));
rotate = Math.round(Radians*180/Math.PI);
this._rotation = rotate;

}
}


this is what is on the rotating MC now

mikkomikko
April 8th, 2005, 11:35 AM
i found out how i can rotate this thing.
Great. Did you understand the easing. You could apply the stuff you learned from webmonkey to this rotation and you would achieve some smoothness. to the rotating thing rotation. =)

Lippuzz_
April 8th, 2005, 05:23 PM
i do not understand the code line properly, but i know what kinda stuf it returns. The rotating runs smooth now.
Now it's time to adjust and extend the code a little bit more and the rotating menu is finished :)