const { ccclass, property } = cc._decorator;

@ccclass
export default class JungleExploration extends cc.Component {

    @property(cc.Node)
    appIcon: cc.Node = null;

    start() {
        if (!this.appIcon) {
            cc.warn("AppIcon node not assigned!");
            return;
        }

        // Step 1: Set initial small scale
        this.appIcon.scale = 0;

        // Step 2: Bounce-in scale animation
        const bounceIn = cc.sequence(
            cc.scaleTo(0.5, 1.2).easing(cc.easeBackOut()),
            cc.scaleTo(0.2, 1.0).easing(cc.easeBounceOut())
        );

        // Step 3: Add floaty up-down forever
        const floatY = cc.repeatForever(
            cc.sequence(
                cc.moveBy(1.2, cc.v2(0, 10)).easing(cc.easeSineInOut()),
                cc.moveBy(1.2, cc.v2(0, -10)).easing(cc.easeSineInOut())
            )
        );

        // Run bounce first, then float forever
        this.appIcon.runAction(cc.sequence(
            bounceIn,
            cc.callFunc(() => {
                this.appIcon.runAction(floatY);
            })
        ));
    }
}
