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

Discussione: cometa con scia

  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2001
    Messaggi
    743

    cometa con scia

    ciao
    sapete dove posso trovare una stella che segue un percorso con la sua scia fluida?

    ho cercato senza trovare nulla

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2001
    Messaggi
    743
    please...
    son disperato.. non riesco a trovare niente
    ;(

  3. #3

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2001
    Messaggi
    743
    mi andava bene la stella che passa..
    l'ho comprata , aperta e non capisco niente
    è difficilissimo...
    è fatta da file .as da un'altro file xml ed il fla

    se cancello qualsiasi cosa tipo lo sfondo non mi funziona niente



    iovoglio prendere quella stella e farla andare sul mio percorso


    mi aiuteresti?

  5. #5
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Invece che cancellare gli oggetti dagli proprietà alpha =0 o visible= false o prova a spostare tutto fuori stage.

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2001
    Messaggi
    743
    ok cosi funziona..
    solo che per il movimento della stella... va solo da sinistra a destra

    io invece volevo piazzare una guida

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Come si sposta via codice?

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2001
    Messaggi
    743
    codice:
    //-- import classes
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import com.greensock.*;
    import com.greensock.easing.*;
    
    //-- number of snow particles
    var noOfSnow:Number = 100;
    //-- load xml to movie
    var xmlLoader:URLLoader;
    //-- hold xml
    var xml:XML;
    //-- size of xml
    var xmlLength:Number;
    //-- set xml path
    var xmlPath:String = "xml/data.xml";
    //-- hold music path
    var musicPath:String;
    //-- hold text in array
    var txtArray:Array = new Array();
    //-- count number of text
    var txtCounter:Number = 0;
    //-- text change delay
    var txtDelay:Number = 2;
    //-- count of star particles
    var noOfParticles:uint = 100;
    //-- hold particles in array
    var particleArr:Array = [];
    //-- cet new sound and sound channel
    var sound:Sound;
    var channel:SoundChannel;
    
    //-- set default values in movie clips
    starAnim_mc.x = -50;
    msk_mc.x = starAnim_mc.x;
    //gift_mc.alpha = 0;
    line_mc.alpha = 0;
    
    //-- create snow and load xml handles
    createSnow();
    loadXML();
    
    function loadXML() {
    	xmlLoader = new URLLoader();
    	xmlLoader.load(new URLRequest("xml/data.xml"));
    	xmlLoader.addEventListener(Event.COMPLETE,onXMLLoadingComplete);
    }
    
    function onXMLLoadingComplete(event:Event):void {
    	xml = new XML(event.target.data);
    	xmlLength = xml.text.length();
    	txtDelay = xml. @ delay;
    	musicPath = xml. @ music;
    
    	for (var i:uint = 0; i<xmlLength; i++) {
    		txtArray.push(xml.text[i].@src);
    	}
    	textHolder.field_mc.text_txt.text = txtArray[txtCounter];
    	animateBalls();
    	loadMusic();
    
    	stage.addEventListener(Event.ENTER_FRAME,updateStage);
    	stage.addEventListener(Event.ENTER_FRAME,setPaticleLocation);
    }
    //-- load music in to movie
    function loadMusic():void{
    	channel = new SoundChannel();
    	sound = new Sound(new URLRequest(musicPath));
    	sound.addEventListener(Event.COMPLETE, onSoundCompleteHandler);
    }
    //-- play loaded music
    function onSoundCompleteHandler(event:Event):void{
    	channel = sound.play();
    }
    
    //-- update stars;
    function updateStage(event:Event):void {
    	if (particleArr.length < noOfParticles) {
    		var star:Star = new Star();
    		particleHolder_mc.addChild(star);
    		star.xVelocity = Math.random() * 10 - 5;
    		star.yVelocity = Math.random() * 10 - 5;
    		star.x = 300;
    		star.y = 0;
    		star.gravity = -2;
    		star.friction = 0.98;
    		star.fade = 0.98;
    		particleArr.push(star);
    	}
    
    	for (var i:uint =0; i<particleArr.length; i++) {
    		var particle:Star = particleArr[i];
    		particleArr[i].update();
    
    		if (particle.x>300 + particle.width/2||particle.x<-particle.width/2 || particle.y>300 + particle.height/2 ||
    		   particle.y<-particle.height/2 || particle.alpha<=0) {
    			particle.xVelocity = Math.random() * 10 - 5;
    			particle.yVelocity = Math.random() * 10 - 5;
    			particle.x = 300;
    			particle.y = 0;
    			particle.scaleX = particle.scaleY = 1;
    			particle.alpha = 1;
    		}
    	}
    }
    //-- set new particle location
    function setPaticleLocation(event:Event):void {
    	particleHolder_mc.x = starAnim_mc.x - 300;
    	if (particleHolder_mc.x>(stage.stageWidth-300)) {
    		new TweenMax(particleHolder_mc,1,{delay:0,alpha:0,ease:Strong.easeOut});
    	}
    	else {
    		particleHolder_mc.alpha = 1;
    	}
    }
    
    //-- create snow
    function createSnow() {
    	for (var i:uint=0; i<noOfSnow; i++) {
    		var snow:Snow = new Snow();
    		addChild(snow);
    	}
    }
    //-- animate red balls
    function animateBalls() {
    	new TweenMax(ball3_mc,0.5,{delay:0.5,alpha:1,y:-60,ease:Strong.easeOut,onComplete:onFinishTween,onCompleteParams:[ball3_mc]});
    	new TweenMax(ball1_mc,0.5,{delay:1,alpha:1,y:-127,ease:Strong.easeOut,onComplete:onFinishTween,onCompleteParams:[ball1_mc]});
    	new TweenMax(ball2_mc,0.5,{delay:1.5,alpha:1,y:-127,ease:Strong.easeOut,onComplete:onFinishTween,onCompleteParams:[ball2_mc]});
    	new TweenMax(line_mc,0.5,{delay:1.5,alpha:1,ease:Strong.easeOut,onComplete:onFinishTween,onCompleteParams:[line_mc]});
    	new TweenMax(gift_mc,0.5,{delay:2,alpha:1,ease:Strong.easeOut,onComplete:AnimateText});
    }
    
    function onFinishTween(param:MovieClip):void {
    	new TweenMax(param,1,{delay:0,alpha:1,y:param.y - 5,ease:Sine.easeInOut,onComplete:onFinishTweenYoyo,onCompleteParams:[param]});
    }
    
    function onFinishTweenYoyo(param:MovieClip):void {
    	new TweenMax(param,1,{delay:0,alpha:1,y:param.y + 5,ease:Sine.easeInOut,onComplete:onFinishTween,onCompleteParams:[param]});
    }
    //-- animate text
    function AnimateText() {
    	textHolder.alpha = 1;
    	particleHolder_mc.alpha = 1;
    	textHolder.field_mc.text_txt.text = txtArray[txtCounter];
    	if (txtCounter<(xmlLength-1)) {
    		txtCounter++;
    	}
    	else {
    		txtCounter = 0;
    	}
    
    	starAnim_mc.x = -50;
    	msk_mc.x = starAnim_mc.x;
    	new TweenMax(starAnim_mc,4,{delay:0,x:750,alpha:1,ease:Strong.easeOut});
    	new TweenMax(starAnim_mc.star_mc,4,{delay:0,rotation:360,alpha:1,ease:Strong.easeOut});
    	new TweenMax(msk_mc,4,{delay:0,x:750,alpha:1,ease:Strong.easeOut});
    	new TweenMax(textHolder,0.5,{delay:txtDelay,alpha:0,ease:Strong.easeOut,onComplete:AnimateText});
    }

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    è proprio nell'ultima funzione sei fortunato perche è fatta con le tweenMax di greensok che hanno la funzione curve di bezier, vai nel sito greensok e scarica il pacchetto troverai delle demo che ti aiuteranno a creare il codice per fargli eseguire il percorso che vuoi.
    lo trovi nel demo plugin explorer

  10. #10
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    !

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.