【練習】
forked from 1軸上の運動量の保存【練習】 (diff: 66)
ActionScript3 source code
/**
* Copyright Tamanegi_kenshi ( http://wonderfl.net/user/Tamanegi_kenshi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7dAh
*/
// forked from Tamanegi_kenshi's 1軸上の運動量の保存【練習】
package{
import flash.display.Sprite;
import flash.events.Event;
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;
import flash.utils.Timer;
import flash.events.*;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.accessibility.Accessibility;
public class test extends Sprite{
private var ball:Ball;
private var balls:Array;
private var isball:Boolean;
private var text1:Array=["テ","ス","ト","で","す"];
private var tex:TextField;
private var texFormat:TextFormat;
private var texs:Array;
public function test(){
init();
}
private function init():void{
texs=new Array();
for(var i:uint=0;i<5;i++){
tex=new TextField();
tex.width=90;
tex.height=100;
tex.x=-100;
tex.y=300;
tex.background=false;
tex.backgroundColor=0xff0000;
texFormat=new TextFormat();
texFormat.size=100;
tex.defaultTextFormat=texFormat;
tex.text=text1[i];
addChild(tex);
texs.push(tex);
}
stage.addEventListener(MouseEvent.CLICK,on);
}
private function on(e:MouseEvent):void{
for(var i:uint=0;i<5;i++){
var ball:TextField=texs[i];
Tweener.addTween(ball,{x:90*i,transition:"easinexpo",time:0.5,delay:1*i});
Tweener.addTween(ball,{alpha:0,y:0,transition:"easout",time:3,delay:5});
}
}
}
}
import flash.display.Sprite;
class Ball extends Sprite{
public var radius:Number;
public var vx:Number=0;
public var vy:Number=0;
public var mass:uint=0;
function Ball (radius:uint){
this.radius=radius;
graphics.beginFill(0x000000);
graphics.drawCircle(0,0,radius);
graphics.endFill();
}
}
