Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onLoad()
- {
- this.moveTo(this.cursor, 1, cursorToStopBtn)
- .then(() => this.bouncing(this.stopButton, 1.1, 4) )
- .then(() => this.moveTo(this.cursor, 1, cursorToInfoBtn))
- .then(() => this.bouncing(this.infoButton, 1.1, 4));
- }
- private moveTo(anyNode: cc.Node, duration: number, toPosition: cc.Vec2): Promise<unknown>
- {
- return new Promise((resolve, reject) =>
- {
- cc.tween(anyNode)
- .to(duration, { position: toPosition })
- .call(resolve)
- .start();
- });
- }
- private bouncing(node: cc.Node, scaleRate: number, repeat: number)
- {
- return new Promise((resolve, reject) =>
- {
- repeat = Math.max(1, repeat);
- cc.tween(node)
- .repeat(repeat, cc.tween()
- .to(0.5, { scale: scaleRate })
- .to(0.5, { scale: 1 })
- )
- .call(resolve)
- .start();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement