Hey guys,
I’m creating this menu that is moveable using startDrag and stopDrag. When you’re dragging it, it also “simulates” real movement by swaying in the wind. However, it doesn’t look too great yet. Can anyone help me out by making this effect more realistic?
[COLOR=“Green”]NOTE: Drag the menu by click-holding the top left yellow thingee.[/COLOR]
Check out the .SWF file below…
Here’s the code:
[AS]
//----- MENU ROTATION EFFECT
rot = 0;
diff = 0;
oldx = menu._x;
function rotate() {
newx = menu._x;
if (newx != oldx) {
newx>oldx ? rot += 3 : rot -= 3;
} else {
rot>0 ? rot -= 3 : null;
rot<0 ? rot += 3 : null;
}
rot>50 ? rot=50 : null;
rot<-50 ? rot=-50 : null;
menu._rotation = rot;
oldx = newx;
}
menu.drag.onPress = function() {
menu.startDrag();
dr = setInterval(rotate, 15);
};
menu.drag.onRelease = function() {
menu.stopDrag();
clearInterval(dr);
};
[/AS]
Thanks in advance! :kommie:
Matt