pinball/assets/_Game/Scripts/UI/FloatingSprite.ts

23 lines
636 B
TypeScript
Raw Permalink Normal View History

2024-06-09 05:12:08 -07:00
import { _decorator, Component, Node, tween, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('FloatingSprite')
export default class FloatingSprite extends Component {
public moveToPosition(target: Vec3, onComplete?: () => void) {
tween(this.node)
.to(
1,
{ worldPosition: target },
{
easing: 'cubicOut',
onComplete: () => {
this.node.releaseToPool();
onComplete?.();
},
},
)
.start();
}
}