particles

Vodpod videos no longer available.

more about "particles", posted with vodpod

AS3:

addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
for (var i:int = 0; i<10; i++){
var particle:MovieClip = new Circle();
particle.x = mouseX;
particle.y = mouseY;
setupParticle(particle);
}
}

function setupParticle(mc:MovieClip):void{
mc.velX = Math.random() * 10 – 5;
mc.velY = Math.random() * 10 – 5;
mc.scaleVel = Math.random() * 0.01 + 0.01;
mc.posX = mc.x;
mc.posY = mc.y;
addChild(mc);
mc.addEventListener(Event.ENTER_FRAME, onRunParticle);
}

function onRunParticle(evt:Event):void{
var mc:MovieClip = MovieClip(evt.currentTarget);
//mc.velY += 1;
mc.posX += mc.velX;
mc.posY += mc.velY;

mc.scaleX -= mc.scaleVel;
mc.scaleY = mc.scaleX;
mc.x = mc.posX;
mc.y = mc.posY;

// kills the particle
if (mc.scaleX stage.stageHeight){
if (mc.parent){
mc.parent.removeChild(mc);
mc.removeEventListener(Event.ENTER_FRAME, onRunParticle);
}
}
//}
}

Draw (Click and Drag) to animate the red ball…3

Vodpod videos no longer available.

more about "animate_along_path", posted with vodpod

AS3:

stage.frameRate = 30;
var pencil:Shape = new Shape();
addChild(pencil);

var index:int = 0;
var points:Array = new Array();
var circle:Shape = new Shape();
circle.graphics.beginFill(0xff6600);
circle.graphics.drawCircle(0,0, 5);
addChild(circle);
circle.x = stage.stageWidth/2;
circle.y = stage.stageHeight/2;
clear_btn.buttonMode = true;

clear_btn.addEventListener(MouseEvent.MOUSE_DOWN, clearStage);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
circle.addEventListener(Event.ENTER_FRAME, onMoveCircle);

function clearStage(evt:MouseEvent):void {
addChild(circle);
}

function onDown(evt:MouseEvent):void {
pencil.graphics.lineStyle(0,0×999999);
pencil.graphics.moveTo(mouseX, mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onDraw);
}

function onUp(evt:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onDraw);
}

function onDraw(evt:Event):void {
pencil.graphics.lineTo(mouseX, mouseY);
points.push(new Point(mouseX, mouseY));
}

function onMoveCircle(evt:Event):void {
if (points.length>0) {
circle.x += (points[index].x – circle.x) / 4;
circle.y += (points[index].y – circle.y) / 4;
index++;
if (index==points.length) {
index=0;
}
}
}

Sunbeam

O Lord, our God, help us to tear their soldiers to bloody shreds
with our shells; help us to cover their smiling fields with the
pale forms of their patriot dead; help us to drown the thunder
of the guns with the shrieks of their wounded, writhing in pain;
help us to lay waste their humble homes with a hurricane of
fire; help us to wring the hearts of their unoffending widows
with unavailing grief; help us to turn them out roofless with
their little children to wander unfriended the wastes of their
desolated land in rags and hunger and thirst, sport of the sunflames
of summer and the icy winds of winter, broken in spirit,
worn with travail, imploring ee for the refuge of the grave
and denied it — for our sakes who adore ee, Lord, blast their
hopes, blight their lives, protract their bitter pilgrimage, make
heavy their steps, water their way with tears, stain the white
snow with the blood of their wounded feet! We ask it, in the
spirit of love, of Him Who is the source of love, and Who is
the ever-faithful refuge and friend of all that are sore beset and
seek His aid with humble and contrite hearts. Amen.
Mark Twain

By bluedawg Design Posted in quotes