Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 30

Discussione: Crea array di tween

  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2007
    Messaggi
    260

    Crea array di tween

    Ciao a tutti...ho realizzato un filmato in flash nel quale ci sono diverse tween.
    Un movieclip in particolare deve eseguire diverse tween contemporaneamente, quindi spostarsi "_x" "_y" e allargarsi "_xscale" ma a seconda del computer sul quale eseguo il filmato l'animazione risulta essere diversa.
    Girando sulla rete ho trovato un post dove dicevano che il problema puo essere risolto inserendo in un array le tween in questione e richiamarle successivamente contemporaneamente.
    come fare in as2?
    ringrazio anticipatamente

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    puoi crearle direttamente dentro l'array attraverso un push del tipo

    var twArr:Array = new Array();
    twArr.push(new Tween(ecc...));

  3. #3
    geniale

    Ciao And, e si potrebbe secondo te scrivere anche i controlli per onMotionFinished ??

    Rempox

  4. #4
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    certo che sì

    Codice PHP:
    var twArr:Array = new Array();
    twArr.push(new Tween(ecc...));
    twArr[indice_desiderato].onMotionFinished = function() {// azioni}; 

  5. #5
    Utente di HTML.it
    Registrato dal
    Mar 2007
    Messaggi
    260
    grazie!ora ci provo!

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    37
    scusate ragazzi ma sono un po imbranata...
    chi mi fa un esempio pratico di utilizzo?
    forse qualcosa del genere???

    var twArr:Array = new Array();
    twArr.push(new Tween(prova, "_rotation", Elastic.easeOut, 0, 360, 3, true));
    twArr.push(new Tween(prova, "_xscale", Elastic.easeOut, 100, 200, 3, true));

    basta così?

    grazie!

  7. #7
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    sì, basta così ma ricorda che devi importare le librerie per utilizzare la classe Tween e le easing function

    Codice PHP:
    import mx.transitions.*;
    import mx.transitions.easing.*;
    var 
    twArr:Array = new Array();
    twArr.push(new Tween(prova"_rotation"Elastic.easeOut03603true));
    twArr.push(new Tween(prova"_xscale"Elastic.easeOut1002003true)); 

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2008
    Messaggi
    37
    si si a quello ci avevo gia pensato!grazie mille!
    pensavo che poi andasse richiamato il tutto con twArr.play(); ma vedo che anche senza la tween parte comunque!

  9. #9
    Utente di HTML.it
    Registrato dal
    Mar 2007
    Messaggi
    260
    scusate ancora ma la situazione non cambia...
    a seconda dei pc, e anche guardandolo su un mac la tween si comporta in modo diverso...

    allora vi spiego ho un oggetto al quale ho applicato delle tween(sicuramente in modo poco elegante!!!) il movimento che deve fare è partire dall'alto, mentre scende deve ingrandirsi e passare da una parte all'altra dello stage..in poche parole è una foglia..
    diciamo che se metto su 3 frame diversi funziona ma su un pc lo vedo bello fluido e come vorrei che fosse, su un altro mi scatta da una parte all'altra in modo nervoso, su un altro ancora scende, si ferma, si allarga e poi riprende!
    premetto che ho gia messo un preload!
    mettendo tutto su un unico frame non funziona affatto...vedo solo parte dell'animazione.
    cmq ho fatto una cosa del genere

    import mx.transitions.*;
    import mx.transitions.easing.*;
    var twArr:Array = new Array();
    twArr.push(new Tween(foglia, "_xscale", Regular.easeInOut, 120, 180, 2, true));
    twArr.push(new Tween(foglia, "_x", Regular.easeInOut, 1100, 300, 1, true));
    twArr.push(new Tween(foglia, "_y", Regular.easeInOut, 120, 180, 1, true));
    twArr.push(new Tween( foglia, "_x", Regular.easeInOut, 300, 900, 1, true));
    twArr.push(new Tween( foglia, "_y", Regular.easeInOut, 180, 360, 1, true));
    twArr.push(new Tween( foglia, "_x", Regular.easeInOut, 900, 495, 1, true));
    twArr.push(new Tween( foglia, "_y", Regular.easeInOut, 360, 550, 1, true));

    esiste un modo più semplice per fargli fare questo tipo di movimento?

    grazie!

  10. #10
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    sono movimenti che vanno concatenati, alla fine di uno richiami l'altro, altrimenti è ovvio che si incartino tra di loro... anche se non è proprio elegante come cosa, dovresti avere questo:

    Codice PHP:
    import mx.transitions.*;
    import mx.transitions.easing.*;
    var 
    twArr:Array = new Array();
    twArr.push(new Tween(foglia"_xscale"Regular.easeInOut1201802true));
    twArr.push(new Tween(foglia"_x"Regular.easeInOut11003001true));
    twArr.push(new Tween(foglia"_y"Regular.easeInOut1201801true));
    twArr[2].onMotionFinished = function () {
        
    twArr.push(new Tweenfoglia"_x"Regular.easeInOut3009001true));
        
    twArr.push(new Tweenfoglia"_y"Regular.easeInOut1803601true));
        
    twArr[4].onMotionFinished = function () {
            
    twArr.push(new Tweenfoglia"_x"Regular.easeInOut9004951true));
            
    twArr.push(new Tweenfoglia"_y"Regular.easeInOut3605501true));
        }


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.