自动旋转问题
This commit is contained in:
@@ -101,7 +101,7 @@
|
|||||||
{
|
{
|
||||||
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
||||||
"scriptPath": "../src/views/common/AutoRotate.ts",
|
"scriptPath": "../src/views/common/AutoRotate.ts",
|
||||||
"speed": 1
|
"speed": 0.2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
"_$id": "fxmpuoug",
|
"_$id": "fxmpuoug",
|
||||||
"_$type": "Box",
|
"_$type": "Box",
|
||||||
"name": "GameDone_DC_H",
|
"name": "GameDone_DC_H",
|
||||||
"width": 1920,
|
"width": 1080,
|
||||||
"height": 1080,
|
"height": 1920,
|
||||||
"_mouseState": 2,
|
"_mouseState": 2,
|
||||||
"drawCallOptimize": true,
|
"drawCallOptimize": true,
|
||||||
"left": 0,
|
"left": 0,
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
"_$id": "qsfvdnby",
|
"_$id": "qsfvdnby",
|
||||||
"_$type": "Image",
|
"_$type": "Image",
|
||||||
"name": "bg_done",
|
"name": "bg_done",
|
||||||
"width": 1920,
|
"width": 1080,
|
||||||
"height": 1080,
|
"height": 1920,
|
||||||
"left": 0,
|
"left": 0,
|
||||||
"right": 0,
|
"right": 0,
|
||||||
"top": 0,
|
"top": 0,
|
||||||
@@ -77,6 +77,8 @@
|
|||||||
"_$id": "ksvwr0iw",
|
"_$id": "ksvwr0iw",
|
||||||
"_$type": "Box",
|
"_$type": "Box",
|
||||||
"name": "center",
|
"name": "center",
|
||||||
|
"x": -420,
|
||||||
|
"y": 420,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"centerX": 0,
|
"centerX": 0,
|
||||||
@@ -115,7 +117,7 @@
|
|||||||
{
|
{
|
||||||
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
||||||
"scriptPath": "../src/views/common/AutoRotate.ts",
|
"scriptPath": "../src/views/common/AutoRotate.ts",
|
||||||
"speed": 1
|
"speed": 0.2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
{
|
{
|
||||||
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
||||||
"scriptPath": "../src/views/common/AutoRotate.ts",
|
"scriptPath": "../src/views/common/AutoRotate.ts",
|
||||||
"speed": 1
|
"speed": 0.2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
"_$id": "mydj8ynl",
|
"_$id": "mydj8ynl",
|
||||||
"_$type": "Box",
|
"_$type": "Box",
|
||||||
"name": "GameDone_Normal_H",
|
"name": "GameDone_Normal_H",
|
||||||
"width": 1920,
|
"width": 1080,
|
||||||
"height": 1080,
|
"height": 1920,
|
||||||
"_mouseState": 2,
|
"_mouseState": 2,
|
||||||
"drawCallOptimize": true,
|
"drawCallOptimize": true,
|
||||||
"left": 0,
|
"left": 0,
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
"_$id": "cofbpy83",
|
"_$id": "cofbpy83",
|
||||||
"_$type": "Image",
|
"_$type": "Image",
|
||||||
"name": "bg_done",
|
"name": "bg_done",
|
||||||
"width": 1920,
|
"width": 1080,
|
||||||
"height": 1080,
|
"height": 1920,
|
||||||
"left": 0,
|
"left": 0,
|
||||||
"right": 0,
|
"right": 0,
|
||||||
"top": 0,
|
"top": 0,
|
||||||
@@ -77,6 +77,8 @@
|
|||||||
"_$id": "bhko8e4w",
|
"_$id": "bhko8e4w",
|
||||||
"_$type": "Box",
|
"_$type": "Box",
|
||||||
"name": "center",
|
"name": "center",
|
||||||
|
"x": -420,
|
||||||
|
"y": 420,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"centerX": 0,
|
"centerX": 0,
|
||||||
@@ -115,7 +117,7 @@
|
|||||||
{
|
{
|
||||||
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
"_$type": "b4f67ca3-86fe-409d-a439-63a715243fb7",
|
||||||
"scriptPath": "../src/views/common/AutoRotate.ts",
|
"scriptPath": "../src/views/common/AutoRotate.ts",
|
||||||
"speed": 1
|
"speed": 0.2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,18 +5,15 @@ export class AutoRotate extends Laya.Script {
|
|||||||
declare owner: Laya.Image
|
declare owner: Laya.Image
|
||||||
|
|
||||||
@property(Number)
|
@property(Number)
|
||||||
public speed: number = 1
|
public speed: number = 0.2
|
||||||
|
|
||||||
private begin = 0
|
private begin = 0
|
||||||
|
|
||||||
// 第一次执行update之前执行,只会执行一次
|
onLateUpdate(): void {
|
||||||
onStart(): void {
|
|
||||||
Laya.timer.loop(100, this, () => {
|
|
||||||
this.begin += this.speed
|
this.begin += this.speed
|
||||||
if (this.begin >= 360) {
|
if (this.begin >= 360) {
|
||||||
this.begin = 0
|
this.begin = 0
|
||||||
}
|
}
|
||||||
this.owner.rotation = this.begin
|
this.owner.rotation = this.begin
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user