BetweenTutorialsBetweenAS3のチュートリアル
1. Simple tweens with BetweenAS3 forked from: 1. Simple tweens with BetweenAS3
- // forked from beinteractive's 1. Simple tweens with BetweenAS3
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import org.libspark.betweenas3.BetweenAS3;
- public class Sample extends Sprite
- {
- public function Sample()
- {
- (addChild(new TextField()) as TextField).text = 'Click to start';
- stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- }
- private function mouseUpHandler(e:MouseEvent):void
- {
- while (numChildren > 0) {
- removeChildAt(0);
- }
- var box1:Box = addNewBox(50);
- var box2:Box = addNewBox(150);
- var box3:Box = addNewBox(250);
- var box4:Box = addNewBox(350);
- // Parameters are:
- // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
- // Simple Tween: from current (20) to 220
- BetweenAS3.tween(box1, {x: 220}).play();
- // From-To Tween: from 120 to 220
- BetweenAS3.tween(box2, {x: 320}, {x: 120}).play();
- // From Tween: from 220 to current (20)
- BetweenAS3.tween(box3, null, {x: 220}).play();
- // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
- BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
- }
- private function addNewBox(y:Number):Box
- {
- var box:Box = new Box();
- box.x = 20;
- box.y = y;
- addChild(box);
- return box;
- }
- }
- }
- import flash.display.Sprite;
- internal class Box extends Sprite
- {
- public function Box()
- {
- graphics.beginFill(0);
- graphics.drawRect(-10, -10, 20, 20);
- graphics.endFill();
- }
- }
1. Simple tweens with BetweenAS3 forked from: 1. Simple tweens with BetweenAS3
- // forked from beinteractive's 1. Simple tweens with BetweenAS3
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import org.libspark.betweenas3.BetweenAS3;
- public class Sample extends Sprite
- {
- public function Sample()
- {
- (addChild(new TextField()) as TextField).text = 'Click to start';
- stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- }
- private function mouseUpHandler(e:MouseEvent):void
- {
- while (numChildren > 0) {
- removeChildAt(0);
- }
- var box1:Box = addNewBox(50);
- var box2:Box = addNewBox(150);
- var box3:Box = addNewBox(250);
- var box4:Box = addNewBox(350);
- // Parameters are:
- // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
- // Simple Tween: from current (20) to 220
- BetweenAS3.tween(box1, {x: 220}).play();
- // From-To Tween: from 120 to 220
- BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
- // From Tween: from 220 to current (20)
- BetweenAS3.tween(box3, null, {x: 220}).play();
- // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
- BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
- }
- private function addNewBox(y:Number):Box
- {
- var box:Box = new Box();
- box.x = 20;
- box.y = y;
- addChild(box);
- return box;
- }
- }
- }
- import flash.display.Sprite;
- internal class Box extends Sprite
- {
- public function Box()
- {
- graphics.beginFill(0);
- graphics.drawRect(-10, -10, 20, 20);
- graphics.endFill();
- }
- }
1. Simple tweens with BetweenAS3 1/19 BetweenAS3 {forked from: 1. Simple tweens with BetweenAS3}
- // forked from beinteractive's 1. Simple tweens with BetweenAS3
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import org.libspark.betweenas3.BetweenAS3;
- import org.libspark.betweenas3.easing.*;
- import org.libspark.betweenas3.tweens.ITween;
- public class Sample extends Sprite
- {
- public function Sample()
- {
- (addChild(new TextField()) as TextField).text = 'Click to start';
- stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- }
- private function mouseUpHandler(e:MouseEvent):void
- {
- while (numChildren > 0) {
- removeChildAt(0);
- }
- //下記で作ったクラスを利用
- var box1:Box = addNewBox(50);
- var box2:Box = addNewBox(150);
- var box3:Box = addNewBox(250);
- var box4:Box = addNewBox(350);
- var box5:Box = addNewBox(450);
- // Parameters are:
- // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
- // Simple Tween: from current (20) to 220
- var t1:ITween = BetweenAS3.tween(box1, {x: 220},null,1.0, Back.easeOut);
- //1秒遅れてt1がスタートする。
- BetweenAS3.delay(t1,1.0).play();
- // From-To Tween: from 120 to 220
- var t2:ITween = BetweenAS3.tween(box2, {x: stage.stageWidth -20}, {x: 20},1.0, Cubic.easeInOut);
- t2.play();
- BetweenAS3.serial(
- BetweenAS3.tween(box3, null, {x: 220},4.0),
- BetweenAS3.tween(box4, {$x: 200}, {$x: 10},3.0,Elastic.easeOut)
- ).play();
- var t5:ITween = BetweenAS3.tween(box5,{y:400},null,1.0,Cubic.easeOut);
- BetweenAS3.repeat(t5,3).play();
- }
- private function addNewBox(y:Number):Box
- {
- var box:Box = new Box(); //下記で作ったクラスを使っている
- box.x = 10;
- box.y = y;
- addChild(box);
- return box;
- }
- }
- }
- import flash.display.Sprite;
- internal class Box extends Sprite
- {
- public function Box()
- {
- graphics.beginFill(Math.random()* 0xffffff);
- graphics.drawRect(-10, -10, 20, 20);
- graphics.endFill();
- }
- }
1. Simple tweens with BetweenAS3 forked from: 1. Simple tweens with BetweenAS3
- // forked from beinteractive's 1. Simple tweens with BetweenAS3
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import org.libspark.betweenas3.BetweenAS3;
- public class Sample extends Sprite
- {
- public function Sample()
- {
- (addChild(new TextField()) as TextField).text = 'Click to start';
- stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- }
- private function mouseUpHandler(e:MouseEvent):void
- {
- while (numChildren > 0) {
- removeChildAt(0);
- }
- var box1:Box = addNewBox(50);
- var box2:Box = addNewBox(150);
- var box3:Box = addNewBox(250);
- var box4:Box = addNewBox(350);
- // Parameters are:
- // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
- // Simple Tween: from current (20) to 220
- BetweenAS3.tween(box1, {x: 220}).play();
- // From-To Tween: from 120 to 220
- BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
- // From Tween: from 220 to current (20)
- BetweenAS3.tween(box3, null, {x: 220}).play();
- // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
- BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
- }
- private function addNewBox(y:Number):Box
- {
- var box:Box = new Box();
- box.x = 20;
- box.y = y;
- addChild(box);
- return box;
- }
- }
- }
- import flash.display.Sprite;
- internal class Box extends Sprite
- {
- public function Box()
- {
- graphics.beginFill(0);
- graphics.drawRect(0, 0, 20, 20);
- graphics.endFill();
- }
- }
1. Simple tweens with BetweenAS3 forked from: 1. Simple tweens with BetweenAS3
- // forked from beinteractive's 1. Simple tweens with BetweenAS3
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import org.libspark.betweenas3.BetweenAS3;
- public class Sample extends Sprite
- {
- public function Sample()
- {
- (addChild(new TextField()) as TextField).text = 'Click to start';
- stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- }
- private function mouseUpHandler(e:MouseEvent):void
- {
- while (numChildren > 0) {
- removeChildAt(0);
- }
- var box1:Box = addNewBox(50);
- var box2:Box = addNewBox(150);
- var box3:Box = addNewBox(250);
- var box4:Box = addNewBox(350);
- // Parameters are:
- // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
- // Simple Tween: from current (20) to 220
- BetweenAS3.tween(box1, {x: 220}).play();
- // From-To Tween: from 120 to 220
- BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
- // From Tween: from 220 to current (20)
- BetweenAS3.tween(box3, null, {x: 220}).play();
- // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
- BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
- }
- private function addNewBox(y:Number):Box
- {
- var box:Box = new Box();
- box.x = 20;
- box.y = y;
- addChild(box);
- return box;
- }
- }
- }
- import flash.display.Sprite;
- internal class Box extends Sprite
- {
- public function Box()
- {
- graphics.beginFill(0);
- graphics.drawRect(-10, -10, 30, 20);
- graphics.endFill();
- }
- }
notice: 





