|
@@ -157,3 +157,50 @@ function cameraFly(position, target) {
|
|
|
'complete': function () {
|
|
|
}
|
|
|
});
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 说明:自动旋转
|
|
|
+ */
|
|
|
+function startRotate() {
|
|
|
+ app.camera.enableRotate = false; // 关闭默认的旋转操作
|
|
|
+ app.camera.enablePan = false; // 关闭默认的平移操作
|
|
|
+ app.camera.enableZoom = false; // 关闭默认的缩放操作
|
|
|
+ // 绕摄像机当前目标点旋转
|
|
|
+ app.camera.rotateAround({
|
|
|
+ target: app.camera.target, // 围绕摄像机当前目标点
|
|
|
+ // object: obj, // 环绕的物体 (object 与 target 的设置互斥)
|
|
|
+ speed: 4, // 环绕飞行的时间(3min)
|
|
|
+ yRotateAngle: 360, // 环绕y轴飞行的旋转角度
|
|
|
+ loopType: THING.LoopType.Repeat // 设置循环类型
|
|
|
+ });
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 说明:停止自动旋转
|
|
|
+ */
|
|
|
+function stopRotate() {
|
|
|
+ app.camera.enableRotate = true; // 开启默认的旋转操作
|
|
|
+ app.camera.enablePan = true; // 开启默认的平移操作
|
|
|
+ app.camera.enableZoom = true; // 开启默认的缩放操作
|
|
|
+ app.camera.stopRotateAround();
|
|
|
+ if (rotateTimer) {
|
|
|
+ clearTimeout(rotateTimer);
|
|
|
+ rotateTimer = null;
|
|
|
+ }
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 说明:重新开始转动,未进行任何操作5s后开始自动旋转
|
|
|
+ */
|
|
|
+function restarRotate() {
|
|
|
+ if (fpsCtrl != null || !$('#sceneSetting .control-menu-pane li.autoRotate').hasClass('selected')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (rotateTimer == null) {
|
|
|
+ rotateTimer = setTimeout(function () {
|
|
|
+ // startRotate();
|
|
|
+ }, restartTime);
|
|
|
+ } else {
|
|
|
+ clearTimeout(rotateTimer);
|
|
|
+ rotateTimer = null;
|
|
|
+ restarRotate();
|
|
|
+ }
|
|
|
+}
|