Antes tem o seu prazer na lei do SENHOR, e na sua lei medita de dia e de noite. Salmos 1.2

Efeito particulas – Estrelas As3

Olá amigos tento tempo sem postar mais nada aqui venho agora com alguns tutoriais.
Com o novo Flash CS5 ficou mais fácil de trabalhar, tipo: fechamento automático das funções e outros, mas vamos ao que interesa.

No Flash abra um novo documento 300×300 e 30fps com background preto.

Desenhe uma estrela de cinco pontas com a “PolyStar Tool” ou faça somente um circulo, selecione e transforme em MovieClip “F8″ dê o nome de instancia de “My Star”.


By Multiarts

Na leyer “ações” no 1º frame aperte F9 e vamos ao action

//importando a classe TweenMax
import com.greensock.TweenMax
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;

//ocultando o mouse
Mouse.hide();

//Iniciando a cor
var currentColor:uint = 0xFFFFFF;

//Este Timer chama a funcao chanceColor() em 0.5 segundos
var colorTime:Timer = new Timer(500, 0)
colorTime.addEventListener(TimerEvent.TIMER, changeColor)
colorTime.start()

//Este timer chama createStar() metodo em 0,01 segundos
var trailTimer:Timer = new Timer(10,0)
trailTimer.addEventListener(TimerEvent.TIMER, createStar)
trailTimer.start()

//Add um ENTER_FRAME para mover as estrelas
addEventListener(Event.ENTER_FRAME, moveStar)

function moveStar(e:Event):void{
myStar.x = Math.random() * stage.stageWidth
myStar.y = Math.random() * stage.stageHeight
}
function changeColor(e:Event):void{
//Aciono a nova cor randomica
currentColor = Math.random() * 0xFFFFFF

//Tween myStar
TweenMax.to(myStar, 0.2, {tint: currentColor})
}
function createStar(e:Event):void{
//Cria uma nova star
var newStar:MyStar = new MyStar();

//Setar as novas coordenadas
newStar.x = myStar.x;
newStar.y = myStar.y;

//Calcular randomicamete trajetos x e y
var targetX:Number = newStar.x + Math.random() * 64 – 32;
var targetY:Number = newStar.y + Math.random() * 64 – 32;

//Calcula a rotação no random
var targetRotation = Math.random() * 360 – 180;

//Add a newStar no stage
addChild(newStar);

/* Eventos tween */
TweenMax.to(newStar, 3, {alpha: 0, scaleX: 5, scaleY: 5, tint: currentColor});
TweenMax.to(newStar, 3, {rotation: targetRotation, x: targetX, y: targetY});
TweenMax.to(newStar, 3, {blurFilter:{blurX:5, blurY:5}, onComplete: removeStar, onCompleteParams: [newStar]});
}

//Esta função é chamda quando uma star’s tween é finalizada
function removeStar(star:MyStar):void {

//Remove a star do stage
removeChild(star);
}

Ctrl+Enter e teste seu filme

http://megaswf.com/serve/40704/?z=Lw1wcGpOEexR49oGCVB5sFv7hptNi2ax2sFQZH3M6skkdClim765ip7QKTxe6EBh

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Sair / Alterar )

Imagem do Twitter

You are commenting using your Twitter account. Sair / Alterar )

Foto do Facebook

You are commenting using your Facebook account. Sair / Alterar )

Connecting to %s

Seguir

Obtenha todo post novo entregue na sua caixa de entrada.