import * as v from 'engine';


export default class AnimationTest extends v.Node2D {
    static instance() {
        return new AnimationTest();
    }

    _enter_tree() {}
    _ready() {
        let icon = this.add_child(new v.Sprite('icon'));
        icon.position.set(50, 100);

        let tween = new v.Tween();
        tween.interpolate_property(icon, 'position.x', 50, 150, 1, 'Quadratic.InOut', 2);
        tween.interpolate_property(icon, 'position.x', 150, 50, 1, 'Quadratic.InOut', 3);
        tween.interpolate_property(icon, 'tint', 0x000000, 0xFFFFFF, 2, 'Quadratic.InOut', 2);
        tween.tween_completed.add(() => {
            console.log('animation end');
        });
        tween.interpolate_method(this, 'fly', 0, 100, 5, 'Quadratic.InOut');
        tween.interpolate_deferred_callback(this, 3, 'deferred_greet', 'Sean');
        tween.interpolate_callback(this, 3, 'greet', 'Sean');
        tween.start();

        icon.tweens.add(tween);
    }
    _process(delta) {}
    _exit_tree() {}

    greet(name) {
        console.log(`hello, ${name}`);
    }
    deferred_greet(name) {
        console.log(`[deferred] hello, ${name}`);
    }

    fly(num) {
        // console.log(`fly: ${num | 0}`);
    }
}

@@ -164,18 +164,155 @@
 tree() %7B
+%0A        this.label = this.add_child(new v.BitmapText('', %7B%0A            font: '32px 04b03',%0A        %7D));%0A        this.label.x = 100;%0A    
 %7D%0A
-
     _rea
@@ -757,16 +757,19 @@
 ed.add((
+key
 ) =%3E %7B%0A 
@@ -791,17 +791,17 @@
 ole.log(
-'
+%60
 animatio
@@ -805,13 +805,22 @@
 tion
+ %5B$%7Bkey%7D%5D
  end
-'
+%60
 );%0A 
@@ -1329,23 +1329,26 @@
     
-// console.log(
+this.label.text = 
 %60fly
@@ -1360,17 +1360,16 @@
 um %7C 0%7D%60
-)
 ;%0A    %7D%0A

Update animation test