自动旋转问题

This commit is contained in:
2025-06-17 20:02:13 +08:00
parent 2ff5cc77b5
commit eb36a104a3
5 changed files with 18 additions and 17 deletions

View File

@@ -5,18 +5,15 @@ export class AutoRotate extends Laya.Script {
declare owner: Laya.Image
@property(Number)
public speed: number = 1
public speed: number = 0.2
private begin = 0
// 第一次执行update之前执行只会执行一次
onStart(): void {
Laya.timer.loop(100, this, () => {
onLateUpdate(): void {
this.begin += this.speed
if (this.begin >= 360) {
this.begin = 0
}
this.owner.rotation = this.begin
})
}
}