Files
sudoku/src/views/common/AutoRotate.ts
2025-05-29 19:15:32 +08:00

23 lines
457 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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