JPKO
%Europe/Berlin %000 %2010, 00:00
Er staan 4 mc's op de tijdlijn. Elk bevat een image(theImage) en een FLVplayback (theInfo)
In eerste instantie zie je alleen het plaatje. Deze hebben een button functie en als je erop klikt dan vervaagd de image en komt de player naar voren.
Kijk anders even op
http://www.jpkdesign.nl/animatie.html
De code die voor dit deel gebruikt wordt is als volgt:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import fl.motion.MotionEvent;
var aboutX=about.x;
var aboutY=about.y;
var aboutScaleX=about.scaleX;
var aboutScaleY=about.scaleY;
var aboutRotation=about.rotation;
about.theImage.buttonMode=true;
about.theImage.addEventListener(MouseEvent.CLICK, aboutOver);
function aboutOver(e:Event):void {
addChild(about);
new Tween(about,"scaleX",Regular.easeInOut,aboutScaleX,1,1,true);
new Tween(about,"scaleY",Regular.easeInOut,aboutScaleY,1,1,true);
new Tween(about,"rotation",Regular.easeInOut,aboutRotation,0,1,true);
new Tween(about,"x",Regular.easeInOut,aboutX,stage.stageWidth/2,1,true);
new Tween(about,"y",Regular.easeInOut,aboutY,stage.stageHeight/2,1,true);
new Tween(about,"rotationY",Regular.easeInOut,about.rotationY,180,0,true);
new Tween(about,"rotationX",Regular.easeInOut,about.rotationX,180,0,true);
new Tween(about.theImage,"alpha",Regular.easeOut,about.theImage.alpha,0,1,true);
}
about.theInfo.spin.addEventListener(MouseEvent.CLI CK, aboutBack);
function aboutBack(e:Event):void {
new Tween(about,"scaleX",Regular.easeInOut,about.scaleX,aboutScaleX,1,true );
new Tween(about,"scaleY",Regular.easeInOut,about.scaleY,aboutScaleY,1,true );
new Tween(about,"rotation",Regular.easeInOut,about.rotation,aboutRotation,0, true);
new Tween(about,"x",Regular.easeInOut,about.x,aboutX,1,true);
new Tween(about,"y",Regular.easeInOut,about.y,aboutY,1,true);
new Tween(about,"rotationY",Regular.easeInOut,about.rotationY,360,0,true);
new Tween(about,"rotationX",Regular.easeInOut,about.rotationX,360,0,true);
new Tween(about.theImage,"alpha",Regular.easeIn,about.theImage.alpha,1,1,true);
}
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {
if (about.scaleX>=1) {
about.addChild(about.theInfo);
} else {
about.addChild(about.theImage);
}
if (port.scaleX>=1) {
port.addChild(port.theInfo);
} else {
port.addChild(port.theImage);
}
if (logo.scaleX>=1) {
logo.addChild(logo.theInfo);
} else {
logo.addChild(logo.theImage);
}
if (valentijn.scaleX>=1) {
valentijn.addChild(valentijn.theInfo);
} else {
valentijn.addChild(valentijn.theImage);
}
}
var portX=port.x;
var portY=port.y;
var portScaleX=port.scaleX;
var portScaleY=port.scaleY;
var portRotation=port.rotation;
port.theImage.buttonMode=true;
port.theImage.addEventListener(MouseEvent.CLICK, portOver);
function portOver(e:Event):void {
addChild(port);
new Tween(port,"scaleX",Regular.easeInOut,portScaleX,1,1,true);
new Tween(port,"scaleY",Regular.easeInOut,portScaleY,1,1,true);
new Tween(port,"rotation",Regular.easeInOut,portRotation,0,1,true);
new Tween(port,"x",Regular.easeInOut,portX,stage.stageWidth/2,1,true);
new Tween(port,"y",Regular.easeInOut,portY,stage.stageHeight/2,1,true);
new Tween(port,"rotationY",Regular.easeInOut,port.rotationY,180,0,true);
new Tween(port,"rotationX",Regular.easeInOut,port.rotationX,180,0,true);
new Tween(port.theImage,"alpha",Regular.easeOut,port.theImage.alpha,0,1,true);
}
port.theInfo.spin.addEventListener(MouseEvent.CLIC K, portBack);
function portBack(e:Event):void {
new Tween(port,"scaleX",Regular.easeInOut,port.scaleX,portScaleX,1,true);
new Tween(port,"scaleY",Regular.easeInOut,port.scaleY,portScaleY,1,true);
//rotate back
new Tween(port,"rotation",Regular.easeInOut,port.rotation,portRotation,1,tr ue);
//move back
new Tween(port,"x",Regular.easeInOut,port.x,portX,1,true);
new Tween(port,"y",Regular.easeInOut,port.y,portY,1,true);
//3D back
new Tween(port,"rotationY",Regular.easeInOut,port.rotationY,360,0,true);
new Tween(port,"rotationX",Regular.easeInOut,port.rotationX,360,0,true);
new Tween(port.theImage,"alpha",Regular.easeIn,port.theImage.alpha,1,1,true);
}
var logoX=logo.x;
var logoY=logo.y;
var logoScaleX=logo.scaleX;
var logoScaleY=logo.scaleY;
var logoRotation=logo.rotation;
logo.theImage.buttonMode=true;
logo.theImage.addEventListener(MouseEvent.CLICK, logoOver);
function logoOver(e:Event):void {
addChild(logo);
new Tween(logo,"scaleX",Regular.easeInOut,logoScaleX,1,1,true);
new Tween(logo,"scaleY",Regular.easeInOut,logoScaleY,1,1,true);
new Tween(logo,"rotation",Regular.easeInOut,logoRotation,0,1,true);
new Tween(logo,"x",Regular.easeInOut,logoX,stage.stageWidth/2,1,true);
new Tween(logo,"y",Regular.easeInOut,logoY,stage.stageHeight/2,1,true);
//3D around
new Tween(logo,"rotationY",Regular.easeInOut,logo.rotationY,180,0,true);
new Tween(logo,"rotationX",Regular.easeInOut,logo.rotationX,180,0,true);
new Tween(logo.theImage,"alpha",Regular.easeOut,logo.theImage.alpha,0,1,true);
}
logo.theInfo.spin.addEventListener(MouseEvent.CLIC K, logoBack);
function logoBack(e:Event):void {
new Tween(logo,"scaleX",Regular.easeInOut,logo.scaleX,logoScaleX,1,true);
new Tween(logo,"scaleY",Regular.easeInOut,logo.scaleY,logoScaleY,1,true);
new Tween(logo,"rotation",Regular.easeInOut,logo.rotation,logoRotation,1,tr ue);
new Tween(logo,"x",Regular.easeInOut,logo.x,logoX,1,true);
new Tween(logo,"y",Regular.easeInOut,logo.y,logoY,1,true);
new Tween(logo,"rotationY",Regular.easeInOut,logo.rotationY,360,0,true);
new Tween(logo,"rotationX",Regular.easeInOut,logo.rotationX,360,0,true);
new Tween(logo.theImage,"alpha",Regular.easeIn,logo.theImage.alpha,1,1,true);
}
var valentijnX=valentijn.x;
var valentijnY=valentijn.y;
var valentijnScaleX=valentijn.scaleX;
var valentijnScaleY=valentijn.scaleY;
var valentijnRotation=valentijn.rotation;
valentijn.theImage.buttonMode=true;
valentijn.theImage.addEventListener(MouseEvent.CLI CK, valentijnOver);
function valentijnOver(e:Event):void {
addChild(valentijn);
new Tween(valentijn,"scaleX",Regular.easeInOut,valentijnScaleX,1,1,true);
new Tween(valentijn,"scaleY",Regular.easeInOut,valentijnScaleY,1,1,true);
new Tween(valentijn,"rotation",Regular.easeInOut,valentijnRotation,0,1,true);
new Tween(valentijn,"x",Regular.easeInOut,valentijnX,stage.stageWidth/2,1,true);
new Tween(valentijn,"y",Regular.easeInOut,valentijnY,stage.stageHeight/2,1,true);
new Tween(valentijn,"rotationY",Regular.easeInOut,valentijn.rotationY,180,0,true) ;
new Tween(valentijn,"rotationX",Regular.easeInOut,valentijn.rotationX,180,0,true) ;
new Tween(valentijn.theImage,"alpha",Regular.easeOut,valentijn.theImage.alpha,0,1,true );
}
valentijn.theInfo.spin.addEventListener(MouseEvent .CLICK, valentijnBack);
function valentijnBack(e:Event):void {
new Tween(valentijn,"scaleX",Regular.easeInOut,valentijn.scaleX,valentijnScale X,1,true);
new Tween(valentijn,"scaleY",Regular.easeInOut,valentijn.scaleY,valentijnScale Y,1,true);
new Tween(valentijn,"rotation",Regular.easeInOut,valentijn.rotation,valentijnRot ation,1,true);
new Tween(valentijn,"x",Regular.easeInOut,valentijn.x,valentijnX,1,true);
new Tween(valentijn,"y",Regular.easeInOut,valentijn.y,valentijnY,1,true);
new Tween(valentijn,"rotationY",Regular.easeInOut,valentijn.rotationY,360,0,true) ;
new Tween(valentijn,"rotationX",Regular.easeInOut,valentijn.rotationX,360,0,true) ;
new Tween(valentijn.theImage,"alpha",Regular.easeIn,valentijn.theImage.alpha,1,1,true) ;
}
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.