I’m trying to make an animation of a rotating building. I have 64 pre-rendered frames in a movie clip, representing a building seen from all angles.
I made a try-out with my own head and 16 frames. Now I want to be able to rotate it, by going left or right with my mouse down. On mouse up it has to ease-out and stop rotating.
frustrating but it just doesn’t work
any help welcome
code (frame 1):
tuur.stop();
//dragging = false;
factor = 0.5;
//factor is de factor waarmee het gebouw terug vertraagt
x = _xmouse;
//x is de plaats van de muis op het moment dat je klikt
cruz = 0;
speed = cruz;
//cruz is de kruissnelheid en beginsnelheid waarmee het gebouw draait
function cruise() {
if (speed>(2*cruz+0.1)) {
speed = speed*factor;
} else {
// speed = 0;
}
if (speed>0){
f = Math.ceil(tuur._currentframe+speed);
}
if (speed<0){
f = Math.floor(tuur._currentframe+speed);
}
if (f>16) {
f -= 16;
}
if (f<1) {
f += 16;
}
tuur.gotoAndStop(Math.floor(f));
}
function controle() {
speed = (_xmouse-x)/100;
// speed = -.5;
if (speed>0){
f = Math.ceil(tuur._currentframe+speed);
}
if (speed<0){
f = Math.floor(tuur._currentframe+speed);
}
if (f>16) {
f -= 16;
}
if (f<1) {
f += 16;
}
tuur.gotoAndStop(f);
}
and the movieclip (tuur):
onClipEvent(mouseDown){
_root.x = _xmouse
clearInterval(cr);
co = setInterval(_root.controle,40)
}
onClipEvent(mouseUp){
clearInterval(co);
cr = setInterval(_root.cruise,40)
}