|
@@ -4,29 +4,21 @@ class TestObject extends Object2D
|
|
|
{
|
|
|
_setup()
|
|
|
{
|
|
|
- this.currTime = 0;
|
|
|
- this.duration = 3;
|
|
|
this.position.y = 300;
|
|
|
this.position.x = 100;
|
|
|
|
|
|
- this.tween = new Tween("myTween");
|
|
|
- this.tween.interpolateProperty(this.position, "x", PROPERTY_TYPE.NUMBER, this.position.x, 400, 2, TRANS_TYPE.LINEAR, EASE_TYPE.OUT, 0);
|
|
|
- // this.tween.interpolateProperty(this.position, "y", PROPERTY_TYPE.NUMBER, this.position.y, 100, 2, TRANS_TYPE.LINEAR, EASE_TYPE.OUT, 0);
|
|
|
- // this.tween.interpolateProperty(this.position, "y", PROPERTY_TYPE.NUMBER, this.position.y, 100, 2, TRANS_TYPE.SINE, EASE_TYPE.OUT, 0);
|
|
|
- this.tween.interpolateProperty(this.position, "y", PROPERTY_TYPE.NUMBER, this.position.y, 100, 3, TRANS_TYPE.CUBIC, EASE_TYPE.IN_OUT, 0);
|
|
|
- // this.tween.interpolateProperty(this.position, "y", PROPERTY_TYPE.NUMBER, this.position.y, 100, 2, TRANS_TYPE.BOUNCE, EASE_TYPE.OUT, 0);
|
|
|
- // this.tween.interpolateProperty(this.position, "y", PROPERTY_TYPE.NUMBER, this.position.y, 100, 2, TRANS_TYPE.ELASTIC, EASE_TYPE.OUT, 0);
|
|
|
- this.addChild(this.tween);
|
|
|
+ this.timer = new Timer("myTimer", 2);
|
|
|
+ this.addChild(this.timer);
|
|
|
}
|
|
|
|
|
|
_update(delta)
|
|
|
{
|
|
|
- // console.log(this.color)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
_draw(delta)
|
|
|
{
|
|
|
- ellipse(0, 0, 20, 20);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -34,7 +26,12 @@ class TestButton extends Button
|
|
|
{
|
|
|
_onMousePressed()
|
|
|
{
|
|
|
- this.getParent().tween.play();
|
|
|
+ this.getParent().getChildByName("myTimer").start();
|
|
|
+ }
|
|
|
+
|
|
|
+ _onMouseReleased()
|
|
|
+ {
|
|
|
+ this.getParent().getChildByName("myTimer").stop();
|
|
|
}
|
|
|
}
|
|
|
|