forked from: Testing this new fangled wonderfl
forked from Testing this new fangled wonderfl (diff: 1)
ActionScript3 source code
/**
* Copyright hakerlab ( http://wonderfl.net/user/hakerlab )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/sDj8
*/
// forked from josefndean's Testing this new fangled wonderfl
// forked from josefndean's flash on 2012-11-7
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public var circle:Sprite = new Sprite();
public var circle2:Sprite = new Sprite();
public var circle3:Sprite = new Sprite();
public var nucleus:Sprite = new Sprite()
public var time:int =0;
public function FlashTest() {
circle.graphics.beginFill(0x445566,1);
circle.graphics.lineStyle(1);
circle.graphics.drawCircle(0,0,2);
circle.graphics.endFill();
stage.addChild(circle);
circle2.graphics.beginFill(0x445566,1);
circle2.graphics.lineStyle(1);
circle2.graphics.drawCircle(0,0,2);
circle2.graphics.endFill();
stage.addChild(circle2);
circle3.graphics.beginFill(0x445566,1);
circle3.graphics.lineStyle(1);
circle3.graphics.drawCircle(0,0,2);
circle3.graphics.endFill();
stage.addChild(circle3);
nucleus.graphics.lineStyle(1);
nucleus.graphics.beginFill(0x445566,1);
nucleus.graphics.drawCircle(-1,-2,3);
nucleus.graphics.drawCircle(1,1,3);
nucleus.graphics.beginFill(0x00ee44,0.9);
nucleus.graphics.drawCircle(1,-2,2);
nucleus.graphics.drawCircle(-2,1,3);
stage.addChild(nucleus);
nucleus.x = 180;
nucleus.y = 180;
stage.addEventListener(Event.ENTER_FRAME,mouseDown);
}
public function mouseDown(e:Event):void{
var shadow:Sprite = newCircle();
shadow.x = circle.x;
shadow.y = circle.y;
shadow.addEventListener(Event.EXIT_FRAME,fadeShadow);
shadow = newCircle();
shadow.x = circle2.x;
shadow.y = circle2.y;
shadow.addEventListener(Event.EXIT_FRAME,fadeShadow);
shadow = newCircle();
shadow.x = circle3.x;
shadow.y = circle3.y;
shadow.addEventListener(Event.EXIT_FRAME,fadeShadow);
++time
circle.y = 180+(100*Math.sin(2.6*time/stage.frameRate));
circle.x = 180+(100*Math.cos(2*time/stage.frameRate));
circle.scaleY = 1+Math.cos(2*time/stage.frameRate);
circle.scaleX = 1+Math.cos(2*time/stage.frameRate);
circle2.y = 180+(80*Math.sin(2.1*time/stage.frameRate));
circle2.x = 180+(102*Math.cos(2.7*time/stage.frameRate));
circle2.scaleY = 1+Math.cos(1.5*time/stage.frameRate);
circle2.scaleX = 1+Math.cos(1.5*time/stage.frameRate);
circle3.y = 180+(90*Math.sin(1.8*time/stage.frameRate));
circle3.x = 180+(109*Math.cos(2.1*time/stage.frameRate));
circle3.scaleY = 1+Math.cos(2.6*time/stage.frameRate);
circle3.scaleX = 1+Math.cos(2.6*time/stage.frameRate);
}
public function newCircle():Sprite{
var circle:Sprite = new Sprite();
circle.graphics.lineStyle(1);
circle.graphics.drawCircle(0,0,1);
stage.addChild(circle);
return circle;
}
public function fadeShadow(e:Event):void{
var shadow:Sprite = Sprite(e.target);
shadow.alpha-=0.1;
if (shadow.alpha <0) {
shadow.removeEventListener(Event.ENTER_FRAME,fadeShadow);
stage.removeChild(shadow);
shadow = null;
}
}
}
}