@realsee/vreo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +465 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/custom.css +52 -0
- package/docs/assets/highlight.css +127 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1388 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Player.Player-1.html +50 -0
- package/docs/enums/Player.InfoPanelTypeEnum.html +3 -0
- package/docs/enums/Player.PanoEffectEnum.html +5 -0
- package/docs/enums/Player.PanoTagEnum.html +3 -0
- package/docs/enums/Player.VreoKeyframeEnum.html +388 -0
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -0
- package/docs/enums/fivePlugins.Rotation.html +1 -0
- package/docs/index.html +204 -0
- package/docs/interfaces/Player.PlayerConfigs.html +4 -0
- package/docs/interfaces/Player.Vertex.html +3 -0
- package/docs/interfaces/Player.VreoKeyframe.html +3 -0
- package/docs/interfaces/Player.VreoUnit.html +3 -0
- package/docs/interfaces/Player.VreoVideo.html +3 -0
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -0
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +7 -0
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -0
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -0
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -0
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -0
- package/docs/interfaces/react.VreoActionCallbacks.html +15 -0
- package/docs/modules/Player.html +29 -0
- package/docs/modules/fivePlugins.html +3 -0
- package/docs/modules/react.html +1 -0
- package/docs/modules.html +1 -0
- package/lib/Player/App.d.ts +2 -0
- package/lib/Player/App.js +68 -0
- package/lib/Player/Controller.d.ts +39 -0
- package/lib/Player/Controller.js +226 -0
- package/lib/Player/hooks.d.ts +4 -0
- package/lib/Player/hooks.js +41 -0
- package/lib/Player/index.d.ts +15 -0
- package/lib/Player/index.js +191 -0
- package/lib/Player/modules/Drawer/index.d.ts +2 -0
- package/lib/Player/modules/Drawer/index.js +67 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +30 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +324 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +10 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +65 -0
- package/lib/Player/modules/VideoAgent/index.d.ts +4 -0
- package/lib/Player/modules/VideoAgent/index.js +44 -0
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/CameraMovement/index.js +73 -0
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/InfoPanel/index.js +89 -0
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/ModelVideo/index.js +87 -0
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/PanoEffect/index.js +142 -0
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.d.ts +5 -0
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +46 -0
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/PanoTag/index.js +168 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +113 -0
- package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/Prompter/index.js +105 -0
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +51 -0
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/VideoEffect/index.js +176 -0
- package/lib/Player/typings.d.ts +14 -0
- package/lib/Player/typings.js +5 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.d.ts +6 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +307 -0
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +48 -0
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +25 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +20 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +305 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/react/index.d.ts +42 -0
- package/lib/react/index.js +120 -0
- package/lib/shared-utils/Preloader.d.ts +6 -0
- package/lib/shared-utils/Preloader.js +51 -0
- package/lib/shared-utils/animationFrame/BetterTween.d.ts +11 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +102 -0
- package/lib/shared-utils/animationFrame/index.d.ts +15 -0
- package/lib/shared-utils/animationFrame/index.js +68 -0
- package/lib/shared-utils/animationFrame/tween.d.ts +75 -0
- package/lib/shared-utils/animationFrame/tween.js +76 -0
- package/lib/typings/VreoUnit.d.ts +204 -0
- package/lib/typings/VreoUnit.js +65 -0
- package/package.json +55 -0
- package/resources/Player/App.tsx +57 -0
- package/resources/Player/Controller.ts +154 -0
- package/resources/Player/hooks.ts +28 -0
- package/resources/Player/index.tsx +115 -0
- package/resources/Player/modules/Drawer/index.tsx +40 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +202 -0
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +38 -0
- package/resources/Player/modules/VideoAgent/index.tsx +31 -0
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +33 -0
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +52 -0
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +44 -0
- package/resources/Player/modules/keyframes/PanoEffect/index.tsx +99 -0
- package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +31 -0
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +127 -0
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +65 -0
- package/resources/Player/modules/keyframes/Prompter/index.tsx +65 -0
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +36 -0
- package/resources/Player/modules/keyframes/VideoEffect/index.tsx +115 -0
- package/resources/Player/typings.ts +15 -0
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +203 -0
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +57 -0
- package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +278 -0
- package/resources/index.ts +1 -0
- package/resources/react/index.tsx +95 -0
- package/resources/shared-utils/Preloader.ts +35 -0
- package/resources/shared-utils/animationFrame/BetterTween.ts +33 -0
- package/resources/shared-utils/animationFrame/index.ts +48 -0
- package/resources/shared-utils/animationFrame/tween.ts +51 -0
- package/resources/typings/VreoUnit.ts +225 -0
- package/stylesheets/default.css +497 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Prompter = Prompter;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
16
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
17
|
+
|
|
18
|
+
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
|
|
30
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
34
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
function Prompter() {
|
|
39
|
+
var _React$useState = React.useState(''),
|
|
40
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
41
|
+
text = _React$useState2[0],
|
|
42
|
+
setText = _React$useState2[1];
|
|
43
|
+
|
|
44
|
+
var _React$useState3 = React.useState(true),
|
|
45
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
46
|
+
hidden = _React$useState4[0],
|
|
47
|
+
setHidden = _React$useState4[1];
|
|
48
|
+
|
|
49
|
+
var ref = React.useRef(null);
|
|
50
|
+
var controller = (0, _hooks.useController)();
|
|
51
|
+
React.useEffect(function () {
|
|
52
|
+
var _controller$configs;
|
|
53
|
+
|
|
54
|
+
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var callback = function callback(keyframe) {
|
|
59
|
+
var start = keyframe.start,
|
|
60
|
+
end = keyframe.end,
|
|
61
|
+
data = keyframe.data;
|
|
62
|
+
setText(data.text);
|
|
63
|
+
setHidden(false);
|
|
64
|
+
|
|
65
|
+
if (ref.current) {
|
|
66
|
+
clearTimeout(ref.current);
|
|
67
|
+
ref.current = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ref.current = setTimeout(function () {
|
|
71
|
+
setHidden(true);
|
|
72
|
+
setTimeout(function () {
|
|
73
|
+
return setText('');
|
|
74
|
+
}, 500);
|
|
75
|
+
if (ref.current) clearTimeout(ref.current);
|
|
76
|
+
ref.current = null;
|
|
77
|
+
}, end - start);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
81
|
+
return function () {
|
|
82
|
+
controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
83
|
+
};
|
|
84
|
+
}, [controller]);
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: (0, _classnames["default"])('vreo-prompter', {
|
|
87
|
+
'vreo-prompter--hidden': hidden
|
|
88
|
+
})
|
|
89
|
+
}, text ?
|
|
90
|
+
/*#__PURE__*/
|
|
91
|
+
|
|
92
|
+
/* @warning "index.js:1 Warning: findDOMNode is deprecated in StrictMode." */
|
|
93
|
+
React.createElement(_reactTransitionGroup.TransitionGroup, {
|
|
94
|
+
className: "vreo-prompter-text"
|
|
95
|
+
}, /*#__PURE__*/React.createElement(_reactTransitionGroup.CSSTransition, {
|
|
96
|
+
key: text,
|
|
97
|
+
classNames: "vreo-prompter-text-transition",
|
|
98
|
+
timeout: 500,
|
|
99
|
+
addEndListener: function addEndListener(node, done) {
|
|
100
|
+
return node.addEventListener('transitionend', done, false);
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "vreo-prompter-innerText"
|
|
104
|
+
}, text))) : undefined);
|
|
105
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.UpdateVRPanorama = UpdateVRPanorama;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _five = require("@realsee/five");
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
16
|
+
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function UpdateVRPanorama() {
|
|
23
|
+
var controller = (0, _hooks.useController)();
|
|
24
|
+
var five = (0, _hooks.useFiveInstance)();
|
|
25
|
+
React.useEffect(function () {
|
|
26
|
+
var callback = function callback(keyframe) {
|
|
27
|
+
var _five$work;
|
|
28
|
+
|
|
29
|
+
var _ref = keyframe.data,
|
|
30
|
+
panoIndex = _ref.panoIndex,
|
|
31
|
+
images = _ref.images;
|
|
32
|
+
var newWorkJSON = JSON.parse(JSON.stringify((_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.work)); // // 原Work数据不能被修改
|
|
33
|
+
|
|
34
|
+
if (newWorkJSON.panorama && newWorkJSON.panorama.list && newWorkJSON.panorama.list[panoIndex]) {
|
|
35
|
+
Object.assign(newWorkJSON.panorama.list[panoIndex], images);
|
|
36
|
+
} else if (newWorkJSON.observers && newWorkJSON.observers[panoIndex] && newWorkJSON.observers[panoIndex].images) {
|
|
37
|
+
Object.assign(newWorkJSON.observers[panoIndex].images, images);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var newWork = (0, _five.parseWork)(newWorkJSON); // // 需要还原么?待定 ...
|
|
41
|
+
|
|
42
|
+
five.load(newWork);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
46
|
+
return function () {
|
|
47
|
+
controller.off(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
48
|
+
};
|
|
49
|
+
}, [controller]);
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
51
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.VideoEffect = VideoEffect;
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
15
|
+
|
|
16
|
+
var _hooks = require("../../../hooks");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
+
|
|
26
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27
|
+
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
32
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
var inlinePlay = function inlinePlay(videoInstance) {
|
|
41
|
+
if (!videoInstance) return;
|
|
42
|
+
|
|
43
|
+
var canplaythrough = function canplaythrough() {
|
|
44
|
+
videoInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
videoInstance.play();
|
|
48
|
+
} catch (error) {}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
videoInstance.addEventListener('canplaythrough', canplaythrough);
|
|
52
|
+
videoInstance.load();
|
|
53
|
+
}; // const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var PI = Math.PI;
|
|
57
|
+
var PI_2 = PI * 2;
|
|
58
|
+
|
|
59
|
+
function VideoEffect() {
|
|
60
|
+
var ref = React.useRef(null);
|
|
61
|
+
var videoRef = React.useRef();
|
|
62
|
+
var controller = (0, _hooks.useController)();
|
|
63
|
+
var timeoutRef = React.useRef();
|
|
64
|
+
|
|
65
|
+
var _React$useState = React.useState(false),
|
|
66
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
67
|
+
visible = _React$useState2[0],
|
|
68
|
+
setVisible = _React$useState2[1];
|
|
69
|
+
|
|
70
|
+
var five = (0, _hooks.useFiveInstance)();
|
|
71
|
+
|
|
72
|
+
var setBlobSrc = function setBlobSrc(blob) {
|
|
73
|
+
if (!videoRef.current) return;
|
|
74
|
+
videoRef.current.src = blob;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
var callback = /*#__PURE__*/function () {
|
|
79
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
|
|
80
|
+
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude;
|
|
81
|
+
|
|
82
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
83
|
+
while (1) {
|
|
84
|
+
switch (_context.prev = _context.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
start = keyframe.start, end = keyframe.end;
|
|
87
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, fov = _ref2.fov, direction = _ref2.direction, panoIndex = _ref2.panoIndex, vector = _ref2.vector;
|
|
88
|
+
_ref3 = function () {
|
|
89
|
+
if (vector) {
|
|
90
|
+
return [vector.longitude, vector.latitude];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!direction) {
|
|
94
|
+
return [0, 0];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
98
|
+
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
99
|
+
var latitude = -Math.asin(direction.y / 1);
|
|
100
|
+
return [longitude, latitude];
|
|
101
|
+
}(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
102
|
+
five.setState({
|
|
103
|
+
fov: fov,
|
|
104
|
+
panoIndex: panoIndex,
|
|
105
|
+
longitude: longitude,
|
|
106
|
+
latitude: latitude
|
|
107
|
+
}, true);
|
|
108
|
+
setBlobSrc(videoSrc);
|
|
109
|
+
inlinePlay(videoRef.current);
|
|
110
|
+
setVisible(true);
|
|
111
|
+
timeoutRef.current = setTimeout(function () {
|
|
112
|
+
var _videoRef$current;
|
|
113
|
+
|
|
114
|
+
if (!((_videoRef$current = videoRef.current) !== null && _videoRef$current !== void 0 && _videoRef$current.paused)) {
|
|
115
|
+
var _videoRef$current2;
|
|
116
|
+
|
|
117
|
+
(_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
setVisible(false);
|
|
121
|
+
setBlobSrc('');
|
|
122
|
+
}, end - start);
|
|
123
|
+
|
|
124
|
+
case 8:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context.stop();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, _callee);
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
return function callback(_x) {
|
|
133
|
+
return _ref.apply(this, arguments);
|
|
134
|
+
};
|
|
135
|
+
}();
|
|
136
|
+
|
|
137
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
138
|
+
return function () {
|
|
139
|
+
controller.off(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
140
|
+
|
|
141
|
+
if (timeoutRef.current) {
|
|
142
|
+
clearTimeout(timeoutRef.current);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}, [controller]);
|
|
146
|
+
React.useEffect(function () {
|
|
147
|
+
var _controller$configs, _controller$configs$v;
|
|
148
|
+
|
|
149
|
+
if (!ref.current) return;
|
|
150
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video'); // <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
151
|
+
|
|
152
|
+
video.setAttribute('playsinline', 'true');
|
|
153
|
+
video.setAttribute('webkit-playsinline', 'true');
|
|
154
|
+
video.setAttribute('autoplay', 'true');
|
|
155
|
+
video.setAttribute('key', 'VideoEffect-video');
|
|
156
|
+
video.setAttribute('class', 'VideoEffect-video');
|
|
157
|
+
videoRef.current = video;
|
|
158
|
+
ref.current.append(videoRef.current);
|
|
159
|
+
document.addEventListener('WeixinJSBridgeReady', function () {
|
|
160
|
+
var _videoRef$current3;
|
|
161
|
+
|
|
162
|
+
(_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 ? void 0 : _videoRef$current3.play();
|
|
163
|
+
}, false);
|
|
164
|
+
if (!ref.current) return; // const asyncfunc = async () => {
|
|
165
|
+
// setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
|
|
166
|
+
// inlinePlay(videoRef.current)
|
|
167
|
+
// }
|
|
168
|
+
// asyncfunc()
|
|
169
|
+
}, []);
|
|
170
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
ref: ref,
|
|
172
|
+
className: (0, _classnames["default"])('VideoEffect', {
|
|
173
|
+
'VideoEffect--visible': visible
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VreoKeyframeConfigMap } from '../typings/VreoUnit';
|
|
2
|
+
export interface PlayerConfigs {
|
|
3
|
+
containter?: ReactDOM.Container;
|
|
4
|
+
keyframeMap: VreoKeyframeConfigMap;
|
|
5
|
+
/**
|
|
6
|
+
* 微信端自动播放功能实现需要提前初始化 Video 实例。
|
|
7
|
+
*
|
|
8
|
+
* 如果需要支持微信浏览器端自动播放需要接入微信SDK及提前初始化好相关 Video 实例。
|
|
9
|
+
*/
|
|
10
|
+
videos?: {
|
|
11
|
+
videoEffect?: HTMLVideoElement;
|
|
12
|
+
modelTVVideo?: HTMLVideoElement;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FivePlugin } from '@realsee/five';
|
|
2
|
+
import { CameraMovementPluginParameterType, CameraMovementPluginExportType } from './typings';
|
|
3
|
+
/**
|
|
4
|
+
* **运镜插件** 模拟类似于电影运镜效果。
|
|
5
|
+
*/
|
|
6
|
+
export declare const CameraMovementPlugin: FivePlugin<CameraMovementPluginParameterType, CameraMovementPluginExportType>;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CameraMovementPlugin = void 0;
|
|
7
|
+
|
|
8
|
+
var _five = require("@realsee/five");
|
|
9
|
+
|
|
10
|
+
var _typings = require("./typings");
|
|
11
|
+
|
|
12
|
+
var _tween = require("../../shared-utils/animationFrame/tween");
|
|
13
|
+
|
|
14
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
|
+
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
|
+
|
|
18
|
+
var PI_2 = Math.PI * 2;
|
|
19
|
+
|
|
20
|
+
function formatLatitude(rad) {
|
|
21
|
+
return rad % PI_2;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function formatLongitude(rad) {
|
|
25
|
+
return (rad % PI_2 + PI_2) % PI_2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
|
|
29
|
+
var PI = Math.PI;
|
|
30
|
+
var PI_2 = PI * 2;
|
|
31
|
+
from = formatLongitude(from);
|
|
32
|
+
to = formatLongitude(to); // 逆时针旋转,初始值必须是较大的值
|
|
33
|
+
|
|
34
|
+
if (rotation === _typings.Rotation.Anticlockwise && from < to) from += PI_2; // 顺时针旋转,结束值必须是较大值
|
|
35
|
+
|
|
36
|
+
if (rotation === _typings.Rotation.Clockwise && to < from) to += PI_2; // Loop 旋转,找锐角旋转
|
|
37
|
+
// 如果 to 比 from 大 180°,逆时针转
|
|
38
|
+
// 如果 from 比 to 大 180°,顺时针转
|
|
39
|
+
|
|
40
|
+
if (rotation === _typings.Rotation.Loop && to - from > PI) return getLongitudeParams(from, to, _typings.Rotation.Anticlockwise);
|
|
41
|
+
if (rotation === _typings.Rotation.Loop && from - to > PI) return getLongitudeParams(from, to, _typings.Rotation.Clockwise);
|
|
42
|
+
return {
|
|
43
|
+
from: from,
|
|
44
|
+
to: to
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function progressNumber(from, to, pst) {
|
|
49
|
+
return from + (to - from) * pst;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* **运镜插件** 模拟类似于电影运镜效果。
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
57
|
+
var move = /*#__PURE__*/function () {
|
|
58
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args, duration) {
|
|
59
|
+
var opts,
|
|
60
|
+
_args = arguments;
|
|
61
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
opts = _args.length > 2 && _args[2] !== undefined ? _args[2] : {
|
|
66
|
+
preload: true
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (opts.asyncStartCallback) {
|
|
70
|
+
opts.asyncStartCallback();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!(args.mode && args.mode !== five.currentMode)) {
|
|
74
|
+
_context.next = 5;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_context.next = 5;
|
|
79
|
+
return new Promise(function (resolve) {
|
|
80
|
+
if (!args.mode) return;
|
|
81
|
+
five.once('modeChange', function (mode) {
|
|
82
|
+
five.once('initAnimationEnded', function () {
|
|
83
|
+
if (mode === args.mode) {
|
|
84
|
+
resolve(true);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
five.changeMode(args.mode, {
|
|
89
|
+
fov: args.fov || undefined,
|
|
90
|
+
latitude: args.latitude || undefined,
|
|
91
|
+
longitude: args.longitude || undefined,
|
|
92
|
+
panoIndex: args.panoIndex || undefined
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
case 5:
|
|
97
|
+
if (!(args.mode === _five.Five.Mode.Floorplan)) {
|
|
98
|
+
_context.next = 7;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return _context.abrupt("return", true);
|
|
103
|
+
|
|
104
|
+
case 7:
|
|
105
|
+
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
106
|
+
_context.next = 10;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_context.next = 10;
|
|
111
|
+
return five.preloadPano(args.panoIndex);
|
|
112
|
+
|
|
113
|
+
case 10:
|
|
114
|
+
if (opts.asyncEndCallback) {
|
|
115
|
+
opts.asyncEndCallback();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
119
|
+
_context.next = 13;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return _context.abrupt("return", true);
|
|
124
|
+
|
|
125
|
+
case 13:
|
|
126
|
+
_context.next = 15;
|
|
127
|
+
return new Promise(function (resolve, reject) {
|
|
128
|
+
var panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
129
|
+
|
|
130
|
+
if (panoIndex !== undefined) {
|
|
131
|
+
five.moveToPano(panoIndex, Object.assign({
|
|
132
|
+
duration: duration,
|
|
133
|
+
// 移动耗时
|
|
134
|
+
moveEndCallback: function moveEndCallback() {
|
|
135
|
+
return resolve(true);
|
|
136
|
+
},
|
|
137
|
+
// 移动结束
|
|
138
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
139
|
+
return reject(false);
|
|
140
|
+
} // 移动开始
|
|
141
|
+
|
|
142
|
+
}, args));
|
|
143
|
+
} else {
|
|
144
|
+
reject(false);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
case 15:
|
|
149
|
+
return _context.abrupt("return", _context.sent);
|
|
150
|
+
|
|
151
|
+
case 16:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context.stop();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, _callee);
|
|
157
|
+
}));
|
|
158
|
+
|
|
159
|
+
return function move(_x, _x2) {
|
|
160
|
+
return _ref.apply(this, arguments);
|
|
161
|
+
};
|
|
162
|
+
}();
|
|
163
|
+
|
|
164
|
+
var getAnimeParams = function getAnimeParams(args) {
|
|
165
|
+
var currentFiveState = five.state; // latitude
|
|
166
|
+
|
|
167
|
+
var fromLatitude = formatLatitude(currentFiveState.latitude);
|
|
168
|
+
var toLatitude = formatLatitude(args.latitude); // longitude
|
|
169
|
+
|
|
170
|
+
var _getLongitudeParams = getLongitudeParams(currentFiveState.longitude, args.longitude, args.rotation || _typings.Rotation.Loop),
|
|
171
|
+
fromLongitude = _getLongitudeParams.from,
|
|
172
|
+
toLongitude = _getLongitudeParams.to; // fov
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
var fromFov = currentFiveState.fov;
|
|
176
|
+
var toFov = args.fov;
|
|
177
|
+
return {
|
|
178
|
+
from: {
|
|
179
|
+
latitude: fromLatitude,
|
|
180
|
+
longitude: fromLongitude,
|
|
181
|
+
fov: fromFov
|
|
182
|
+
},
|
|
183
|
+
to: {
|
|
184
|
+
latitude: toLatitude,
|
|
185
|
+
longitude: toLongitude,
|
|
186
|
+
fov: toFov
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
var rotate = /*#__PURE__*/function () {
|
|
192
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(args, duration) {
|
|
193
|
+
var opts,
|
|
194
|
+
_getAnimeParams,
|
|
195
|
+
from,
|
|
196
|
+
to,
|
|
197
|
+
_args2 = arguments;
|
|
198
|
+
|
|
199
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
200
|
+
while (1) {
|
|
201
|
+
switch (_context2.prev = _context2.next) {
|
|
202
|
+
case 0:
|
|
203
|
+
opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
204
|
+
|
|
205
|
+
if (opts.asyncStartCallback) {
|
|
206
|
+
opts.asyncStartCallback();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (!(five.currentMode !== _five.Five.Mode.Panorama)) {
|
|
210
|
+
_context2.next = 5;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_context2.next = 5;
|
|
215
|
+
return five.changeMode(_five.Five.Mode.Panorama);
|
|
216
|
+
|
|
217
|
+
case 5:
|
|
218
|
+
if (!(args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
219
|
+
_context2.next = 11;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!opts.preload) {
|
|
224
|
+
_context2.next = 9;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
_context2.next = 9;
|
|
229
|
+
return five.preloadPano(args.panoIndex);
|
|
230
|
+
|
|
231
|
+
case 9:
|
|
232
|
+
_context2.next = 11;
|
|
233
|
+
return new Promise(function (resolve, reject) {
|
|
234
|
+
five.moveToPano(args.panoIndex, {
|
|
235
|
+
moveEndCallback: function moveEndCallback() {
|
|
236
|
+
return resolve(true);
|
|
237
|
+
},
|
|
238
|
+
// 移动结束
|
|
239
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
240
|
+
return reject(false);
|
|
241
|
+
} // 移动开始
|
|
242
|
+
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
case 11:
|
|
247
|
+
if (opts.asyncEndCallback) {
|
|
248
|
+
opts.asyncEndCallback();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
_getAnimeParams = getAnimeParams(args), from = _getAnimeParams.from, to = _getAnimeParams.to;
|
|
252
|
+
_context2.next = 15;
|
|
253
|
+
return new Promise(function (resolve, reject) {
|
|
254
|
+
var onUpdate = function onUpdate(_ref3) {
|
|
255
|
+
var progress = _ref3.progress;
|
|
256
|
+
var state = {};
|
|
257
|
+
state.longitude = progressNumber(from.longitude, to.longitude, progress);
|
|
258
|
+
state.latitude = progressNumber(from.latitude, to.latitude, progress);
|
|
259
|
+
state.fov = progressNumber(from.fov, to.fov, progress);
|
|
260
|
+
five.setState(state, true);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
var onComplete = function onComplete() {
|
|
264
|
+
resolve(true);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var onDestroy = function onDestroy() {
|
|
268
|
+
resolve(false);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
var animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
|
|
272
|
+
var tween = (0, _tween.tweenProgress)(animeDuration, _tween.Easing.Linear.None).onUpdate(onUpdate).onComplete(onComplete).onDestroy(onDestroy);
|
|
273
|
+
|
|
274
|
+
if (args.rotation === _typings.Rotation.Loop) {
|
|
275
|
+
tween.repeat(Infinity).yoyo(true);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
setTimeout(function () {
|
|
279
|
+
// 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
|
|
280
|
+
tween.destroy();
|
|
281
|
+
resolve(true);
|
|
282
|
+
}, duration);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
case 15:
|
|
286
|
+
return _context2.abrupt("return", _context2.sent);
|
|
287
|
+
|
|
288
|
+
case 16:
|
|
289
|
+
case "end":
|
|
290
|
+
return _context2.stop();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}, _callee2);
|
|
294
|
+
}));
|
|
295
|
+
|
|
296
|
+
return function rotate(_x3, _x4) {
|
|
297
|
+
return _ref2.apply(this, arguments);
|
|
298
|
+
};
|
|
299
|
+
}();
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
move: move,
|
|
303
|
+
rotate: rotate
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
exports.CameraMovementPlugin = CameraMovementPlugin;
|