Ciao raga,
ho bisogno di voi per andare avanti.
Ho un menu con i pulsanti tutt'intorno al logo. Vorrei che il logo ruotasse in base alla posizione del mouse. Come faccio?
![]()
Cià e grazie.
Ang
Ciao raga,
ho bisogno di voi per andare avanti.
Ho un menu con i pulsanti tutt'intorno al logo. Vorrei che il logo ruotasse in base alla posizione del mouse. Come faccio?
![]()
Cià e grazie.
Ang
non si finisce mai di sperare...
Hai già l'animazione base del logo che ruota?
ho un'animazione del logo che ruota creata su due keyframe incrementando la var i se non raggiunge 360.
non si finisce mai di sperare...
aspetta, ruota come la ruota di una macchina (scusa il gioco di parole)?
ruota su se stesso.
Poi ha una freccia che fa da puntatore
non si finisce mai di sperare...
E come vuoi che ruoti, rispetto al mouse?
Vorrei che la freccia-puntatore ruotasse nella direzione dove si trova il mouse rimanendo ancorato al suo centro e al centro del filmato.
non so se... sono stata spiegata...:master:
non si finisce mai di sperare...
ruota_mc e' un movieClip con punto di registrazione al centro ....
scusa se non e' perfetta ma coi semiquadri e la geometria ho cominciato da poco.
ti dico il bug:
se vai da piu' di 270° a meno di 270 [ lo 0 e' la x0 e y0 dello stage ] fa il giro dall' altra parte ... altrimenti e' OK [ quindi orario OK, antiorario OK tranne a 270 ]
.... se riesci a perfezionarlo fammelo sapere
![]()
Codice PHP:
ruota_mc.onEnterFrame = function() {
var x = _root._xmouse;
var y = _root._ymouse;
if(x<Stage.width/2 && y<Stage.height/2) {
var x_rot = (( x * 180 ) / Stage.width);
var y_rot = -(( y * 180 ) / Stage.height);
var ruota = ((y_rot/2)+(x_rot/2));
}
else if(x>Stage.width/2 && y<Stage.height/2) {
var x_rot = (( x * 180 ) / Stage.width);
var y_rot = (( y * 180 ) / Stage.height);
var ruota = ((y_rot/2)+(x_rot/2));
}
else if(x>Stage.width/2 && y>Stage.height/2) {
var x_rot = -(( x * 180 ) / Stage.width);
var y_rot = (( y * 180 ) / Stage.height);
var ruota = 180 + ((y_rot/2)+(x_rot/2));
}
else {
var x_rot = -(( x * 180 ) / Stage.width);
var y_rot = -(( y * 180 ) / Stage.height);
var ruota = ((y_rot/2)+(x_rot/2));
}
if( ruota < 180 ) {
this._rotation += ( ruota - this._rotation ) / 10;
}
else {
this._rotation += ( ruota - 360 - this._rotation ) / 10;
}
}
Flash5:
associ al movieclip del logo:
codice:onClipEvent(mouseMove){ var x = Math.round(_root._xmouse - this._x); var y = Math.round(_root._ymouse - this._y); var z = Math.atan(y / x) * (180 / Math.PI); this._rotation = x < 0 ? Math.round(180 + z) : z; updateAfterEvent(); }
Flash MX:
scrivi nello stesso frame del logo:
codice:this.logo.onMouseMove = function() { var x = Math.round(_root._xmouse - this._x); var y = Math.round(_root._ymouse - this._y); var z = Math.atan(y / x) * (180 / Math.PI); this._rotation = x < 0 ? Math.round(180 + z) : z; updateAfterEvent(); }
... esattamente quello che mi mancava ... lo dicevo io ke ero fagiano in geometria ...Originariamente inviato da negatyve
var z = Math.atan(y / x) * (180 / Math.PI);
updateAfterEvent(); <-- questa ??? :master: