@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,102 @@
|
|
|
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.BetterTween = void 0;
|
|
9
|
+
exports.tweenProgress = tweenProgress;
|
|
10
|
+
|
|
11
|
+
var _tween = _interopRequireDefault(require("@tweenjs/tween.js"));
|
|
12
|
+
|
|
13
|
+
var _ = require(".");
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
+
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
|
|
19
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
+
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
+
|
|
23
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
24
|
+
|
|
25
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
26
|
+
|
|
27
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
+
|
|
29
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
+
|
|
31
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
|
+
|
|
33
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
|
+
|
|
35
|
+
var BetterTween = /*#__PURE__*/function (_TWEEN$Tween) {
|
|
36
|
+
_inherits(BetterTween, _TWEEN$Tween);
|
|
37
|
+
|
|
38
|
+
var _super = _createSuper(BetterTween);
|
|
39
|
+
|
|
40
|
+
function BetterTween() {
|
|
41
|
+
var _this;
|
|
42
|
+
|
|
43
|
+
_classCallCheck(this, BetterTween);
|
|
44
|
+
|
|
45
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
46
|
+
args[_key] = arguments[_key];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
50
|
+
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "disposeMethods", []);
|
|
52
|
+
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "onDispose", function (callback) {
|
|
54
|
+
_this.disposeMethods.push(callback);
|
|
55
|
+
|
|
56
|
+
return _assertThisInitialized(_this);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "play", function () {
|
|
60
|
+
_this.start();
|
|
61
|
+
|
|
62
|
+
_this.animationFrameDisposer = (0, _.requestAnimationFrameInterval)(function () {
|
|
63
|
+
return _this.update();
|
|
64
|
+
});
|
|
65
|
+
return _assertThisInitialized(_this);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "dispose", function () {
|
|
69
|
+
var _this$animationFrameD, _this2;
|
|
70
|
+
|
|
71
|
+
_this.stop();
|
|
72
|
+
|
|
73
|
+
(_this$animationFrameD = (_this2 = _this).animationFrameDisposer) === null || _this$animationFrameD === void 0 ? void 0 : _this$animationFrameD.call(_this2);
|
|
74
|
+
|
|
75
|
+
_this.disposeMethods.forEach(function (fn) {
|
|
76
|
+
return fn();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
_this.disposeMethods = [];
|
|
80
|
+
|
|
81
|
+
_tween["default"].remove(_assertThisInitialized(_this));
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return BetterTween;
|
|
88
|
+
}(_tween["default"].Tween);
|
|
89
|
+
|
|
90
|
+
exports.BetterTween = BetterTween;
|
|
91
|
+
|
|
92
|
+
function tweenProgress(duration) {
|
|
93
|
+
var easing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _tween["default"].Easing.Linear.None;
|
|
94
|
+
var tween = new BetterTween({
|
|
95
|
+
progress: 0
|
|
96
|
+
}).to({
|
|
97
|
+
progress: 1
|
|
98
|
+
});
|
|
99
|
+
if (duration !== undefined) tween.duration(duration);
|
|
100
|
+
if (easing !== undefined) tween.easing(easing);
|
|
101
|
+
return tween;
|
|
102
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
2
|
+
export default _requestAnimationFrame;
|
|
3
|
+
export declare function nextFrame(fn: FrameRequestCallback, delay?: number): void;
|
|
4
|
+
/**
|
|
5
|
+
* 在每个 AnimationFrame 中调用传入的函数
|
|
6
|
+
* @param callback 每次 AnimationFrame 中调用的函数
|
|
7
|
+
* @param frame 每秒运行多少次
|
|
8
|
+
* @returns 返回一个函数,调用可以停止 AnimationFrameLoop
|
|
9
|
+
*/
|
|
10
|
+
export declare function requestAnimationFrameInterval(callback?: (time: number) => any, frame?: number): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* 获取两个 AnimationFrame 间隔的时间
|
|
13
|
+
* @returns 返回一个 Promise,resolve 的结果是两个 AnimationFrame 间隔的时间
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFrameTime(): Promise<unknown>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
exports.getFrameTime = getFrameTime;
|
|
8
|
+
exports.nextFrame = nextFrame;
|
|
9
|
+
exports.requestAnimationFrameInterval = requestAnimationFrameInterval;
|
|
10
|
+
|
|
11
|
+
var _requestAnimationFrame = window.requestAnimationFrame || function (fn) {
|
|
12
|
+
return setTimeout(fn, 16);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
|
16
|
+
|
|
17
|
+
var _default = _requestAnimationFrame;
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
|
|
20
|
+
function nextFrame(fn) {
|
|
21
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
22
|
+
if (delay <= 0) _requestAnimationFrame(fn);else _requestAnimationFrame(function () {
|
|
23
|
+
return nextFrame(fn, delay - 1);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 在每个 AnimationFrame 中调用传入的函数
|
|
28
|
+
* @param callback 每次 AnimationFrame 中调用的函数
|
|
29
|
+
* @param frame 每秒运行多少次
|
|
30
|
+
* @returns 返回一个函数,调用可以停止 AnimationFrameLoop
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function requestAnimationFrameInterval(callback) {
|
|
35
|
+
var frame = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
|
|
36
|
+
var index = -1;
|
|
37
|
+
var oldTime = 0;
|
|
38
|
+
var startTime = -1;
|
|
39
|
+
var minDeltaTime = 1000 / frame;
|
|
40
|
+
|
|
41
|
+
function loop(time) {
|
|
42
|
+
startTime === -1 && (startTime = time);
|
|
43
|
+
index = _requestAnimationFrame(loop);
|
|
44
|
+
var deltaTime = time - oldTime;
|
|
45
|
+
if (deltaTime < minDeltaTime) return;
|
|
46
|
+
oldTime = time;
|
|
47
|
+
callback && callback(time - startTime);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
index = _requestAnimationFrame(loop);
|
|
51
|
+
return function stop() {
|
|
52
|
+
_cancelAnimationFrame(index);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 获取两个 AnimationFrame 间隔的时间
|
|
57
|
+
* @returns 返回一个 Promise,resolve 的结果是两个 AnimationFrame 间隔的时间
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
function getFrameTime() {
|
|
62
|
+
var start = Date.now();
|
|
63
|
+
return new Promise(function (resolve) {
|
|
64
|
+
_requestAnimationFrame(function () {
|
|
65
|
+
resolve(Date.now() - start);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as TWEEN from '@tweenjs/tween.js';
|
|
2
|
+
export declare const Easing: {
|
|
3
|
+
Linear: {
|
|
4
|
+
None: (amount: number) => number;
|
|
5
|
+
};
|
|
6
|
+
Quadratic: {
|
|
7
|
+
In: (amount: number) => number;
|
|
8
|
+
Out: (amount: number) => number;
|
|
9
|
+
InOut: (amount: number) => number;
|
|
10
|
+
};
|
|
11
|
+
Cubic: {
|
|
12
|
+
In: (amount: number) => number;
|
|
13
|
+
Out: (amount: number) => number;
|
|
14
|
+
InOut: (amount: number) => number;
|
|
15
|
+
};
|
|
16
|
+
Quartic: {
|
|
17
|
+
In: (amount: number) => number;
|
|
18
|
+
Out: (amount: number) => number;
|
|
19
|
+
InOut: (amount: number) => number;
|
|
20
|
+
};
|
|
21
|
+
Quintic: {
|
|
22
|
+
In: (amount: number) => number;
|
|
23
|
+
Out: (amount: number) => number;
|
|
24
|
+
InOut: (amount: number) => number;
|
|
25
|
+
};
|
|
26
|
+
Sinusoidal: {
|
|
27
|
+
In: (amount: number) => number;
|
|
28
|
+
Out: (amount: number) => number;
|
|
29
|
+
InOut: (amount: number) => number;
|
|
30
|
+
};
|
|
31
|
+
Exponential: {
|
|
32
|
+
In: (amount: number) => number;
|
|
33
|
+
Out: (amount: number) => number;
|
|
34
|
+
InOut: (amount: number) => number;
|
|
35
|
+
};
|
|
36
|
+
Circular: {
|
|
37
|
+
In: (amount: number) => number;
|
|
38
|
+
Out: (amount: number) => number;
|
|
39
|
+
InOut: (amount: number) => number;
|
|
40
|
+
};
|
|
41
|
+
Elastic: {
|
|
42
|
+
In: (amount: number) => number;
|
|
43
|
+
Out: (amount: number) => number;
|
|
44
|
+
InOut: (amount: number) => number;
|
|
45
|
+
};
|
|
46
|
+
Back: {
|
|
47
|
+
In: (amount: number) => number;
|
|
48
|
+
Out: (amount: number) => number;
|
|
49
|
+
InOut: (amount: number) => number;
|
|
50
|
+
};
|
|
51
|
+
Bounce: {
|
|
52
|
+
In: (amount: number) => number;
|
|
53
|
+
Out: (amount: number) => number;
|
|
54
|
+
InOut: (amount: number) => number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
interface ITween<T> extends TWEEN.Tween<T> {
|
|
58
|
+
onDestroy: (fn: () => void) => TWEEN.Tween<T>;
|
|
59
|
+
destroy: () => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 对象变化的补间动画
|
|
63
|
+
* 1. 应用 requestAnimationFrameInterval 做 update
|
|
64
|
+
* 2. 在原生 tween 上新增 destroy 方法和 onDestroy 监听
|
|
65
|
+
* DOC: https://github.com/tweenjs/tween.js
|
|
66
|
+
* @param from 对象起始状态
|
|
67
|
+
* @param to 对象末尾状态
|
|
68
|
+
* @param duration 经历时间(s)
|
|
69
|
+
* @param easing 过程动画,默认是 Easing.Linear.None
|
|
70
|
+
*/
|
|
71
|
+
export default function tween<T>(from: T, to: T, duration: number, easing?: (amount: number) => number): ITween<T>;
|
|
72
|
+
export declare function tweenProgress(duration: number, easing: typeof Easing.Linear.None): ITween<{
|
|
73
|
+
progress: number;
|
|
74
|
+
}>;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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.Easing = void 0;
|
|
9
|
+
exports["default"] = tween;
|
|
10
|
+
exports.tweenProgress = tweenProgress;
|
|
11
|
+
|
|
12
|
+
var TWEEN = _interopRequireWildcard(require("@tweenjs/tween.js"));
|
|
13
|
+
|
|
14
|
+
var _index = require("./index");
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
var Easing = TWEEN.Easing;
|
|
21
|
+
exports.Easing = Easing;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 对象变化的补间动画
|
|
25
|
+
* 1. 应用 requestAnimationFrameInterval 做 update
|
|
26
|
+
* 2. 在原生 tween 上新增 destroy 方法和 onDestroy 监听
|
|
27
|
+
* DOC: https://github.com/tweenjs/tween.js
|
|
28
|
+
* @param from 对象起始状态
|
|
29
|
+
* @param to 对象末尾状态
|
|
30
|
+
* @param duration 经历时间(s)
|
|
31
|
+
* @param easing 过程动画,默认是 Easing.Linear.None
|
|
32
|
+
*/
|
|
33
|
+
function tween(from, to, duration) {
|
|
34
|
+
var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Easing.Linear.None;
|
|
35
|
+
var tween = new TWEEN.Tween(from).to(to, duration).easing(easing); // 这里注意一下,因为 requestAnimationFrameInterval 给的时间是从 0 开始的,tween 动画也从 0 开始
|
|
36
|
+
|
|
37
|
+
(0, _index.nextFrame)(function () {
|
|
38
|
+
return tween.start(0);
|
|
39
|
+
});
|
|
40
|
+
var cancelAnimationFrame = (0, _index.requestAnimationFrameInterval)(function (time) {
|
|
41
|
+
if (tween.update(time) === false) cancelAnimationFrame();
|
|
42
|
+
});
|
|
43
|
+
var destroyMethods = [];
|
|
44
|
+
|
|
45
|
+
tween.onDestroy = function (fn) {
|
|
46
|
+
destroyMethods.push(fn);
|
|
47
|
+
return tween;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
tween.destroy = function () {
|
|
51
|
+
this.stop();
|
|
52
|
+
Object.assign(tween, {
|
|
53
|
+
_onStartCallback: null,
|
|
54
|
+
_onUpdateCallback: null,
|
|
55
|
+
_onCompleteCallback: null,
|
|
56
|
+
_onStopCallbackL: null
|
|
57
|
+
});
|
|
58
|
+
var destroyMethod;
|
|
59
|
+
|
|
60
|
+
while (destroyMethod = destroyMethods.shift()) {
|
|
61
|
+
destroyMethod();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
cancelAnimationFrame();
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return tween;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function tweenProgress(duration, easing) {
|
|
71
|
+
return tween({
|
|
72
|
+
progress: 0
|
|
73
|
+
}, {
|
|
74
|
+
progress: 1
|
|
75
|
+
}, duration, easing);
|
|
76
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Mode, Pose, WorkCubeImage } from '@realsee/five';
|
|
2
|
+
import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings';
|
|
3
|
+
export declare enum VreoKeyframeEnum {
|
|
4
|
+
/** 运镜 */
|
|
5
|
+
CameraMovement = "CameraMovement",
|
|
6
|
+
/**
|
|
7
|
+
* 全景标签
|
|
8
|
+
*/
|
|
9
|
+
PanoTag = "PanoTag",
|
|
10
|
+
/**
|
|
11
|
+
* 全景文本标签
|
|
12
|
+
*/
|
|
13
|
+
PanoTextLabel = "PanoTextLabel",
|
|
14
|
+
/**
|
|
15
|
+
* 提词器
|
|
16
|
+
*/
|
|
17
|
+
Prompter = "Prompter",
|
|
18
|
+
/**
|
|
19
|
+
* 更新 VR 全景
|
|
20
|
+
*/
|
|
21
|
+
UpdateVRPanorama = "UpdateVRPanorama",
|
|
22
|
+
/**
|
|
23
|
+
* 视频广告
|
|
24
|
+
*/
|
|
25
|
+
ModelVideo = "ModelVideo",
|
|
26
|
+
/**
|
|
27
|
+
* 全景特效
|
|
28
|
+
*/
|
|
29
|
+
PanoEffect = "PanoEffect",
|
|
30
|
+
/**
|
|
31
|
+
* 信息面板
|
|
32
|
+
*/
|
|
33
|
+
InfoPanel = "InfoPanel",
|
|
34
|
+
/**
|
|
35
|
+
* 视频特效
|
|
36
|
+
*/
|
|
37
|
+
VideoEffect = "VideoEffect",
|
|
38
|
+
/**
|
|
39
|
+
* 结束
|
|
40
|
+
*/
|
|
41
|
+
Exit = "Exit"
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 支持自定义剧本关键帧配置项
|
|
45
|
+
*/
|
|
46
|
+
export declare type VreoKeyframeConfigMap = {
|
|
47
|
+
PanoTag?: false;
|
|
48
|
+
PanoTextLabel?: false;
|
|
49
|
+
Prompter?: false;
|
|
50
|
+
InfoPanel?: false;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* 剧本关键帧
|
|
54
|
+
*/
|
|
55
|
+
export interface VreoKeyframe {
|
|
56
|
+
type: VreoKeyframeEnum;
|
|
57
|
+
start: number;
|
|
58
|
+
end: number;
|
|
59
|
+
parsed?: boolean;
|
|
60
|
+
data: Record<string, any>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 虚拟视频角色
|
|
64
|
+
*/
|
|
65
|
+
export interface VreoVideo {
|
|
66
|
+
duration: number;
|
|
67
|
+
start: number;
|
|
68
|
+
end: number;
|
|
69
|
+
url: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 剧本结构
|
|
73
|
+
*/
|
|
74
|
+
export interface VreoUnit {
|
|
75
|
+
categoryId: string;
|
|
76
|
+
categoryText: string;
|
|
77
|
+
frontRequestId: string;
|
|
78
|
+
index: string | number;
|
|
79
|
+
keyframes: VreoKeyframe[];
|
|
80
|
+
video: VreoVideo;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 剧本事件
|
|
84
|
+
*/
|
|
85
|
+
export declare type VreoKeyframeEvent = {
|
|
86
|
+
[key in VreoKeyframeEnum]: (keyframe: VreoKeyframe) => void;
|
|
87
|
+
} & {
|
|
88
|
+
paused: () => void;
|
|
89
|
+
playing: () => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* 相机运动
|
|
93
|
+
*/
|
|
94
|
+
export declare type CameraMovementData = {
|
|
95
|
+
effect: CameraMovementEffect;
|
|
96
|
+
mode: Mode;
|
|
97
|
+
panoIndex: number;
|
|
98
|
+
loop?: boolean;
|
|
99
|
+
rotateSpeed?: number;
|
|
100
|
+
rotation?: Rotation;
|
|
101
|
+
} & Partial<Pose>;
|
|
102
|
+
/**
|
|
103
|
+
* 提词器
|
|
104
|
+
*/
|
|
105
|
+
export declare type PrompterData = {
|
|
106
|
+
text: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* VR 全景切换
|
|
110
|
+
*/
|
|
111
|
+
export declare type UpdateVRPanoramaData = {
|
|
112
|
+
panoIndex: number;
|
|
113
|
+
images: WorkCubeImage;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* 顶点
|
|
117
|
+
*/
|
|
118
|
+
export interface Vertex {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
z: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 四个顶点元组
|
|
125
|
+
*/
|
|
126
|
+
export declare type QuadrangleVertexs = [Vertex, Vertex, Vertex, Vertex];
|
|
127
|
+
/**
|
|
128
|
+
* 视频广告
|
|
129
|
+
*/
|
|
130
|
+
export declare type ModelVideoData = {
|
|
131
|
+
/**
|
|
132
|
+
* 视频素材
|
|
133
|
+
*/
|
|
134
|
+
videoSrc: string;
|
|
135
|
+
/**
|
|
136
|
+
* 视频封面
|
|
137
|
+
*/
|
|
138
|
+
videoPosterSrc: string;
|
|
139
|
+
/**
|
|
140
|
+
* 视频映射在模型中的顶点
|
|
141
|
+
*/
|
|
142
|
+
vertexs: QuadrangleVertexs;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* 全景文本标签
|
|
146
|
+
*/
|
|
147
|
+
export declare type PanoTextLabelData = {
|
|
148
|
+
text: string;
|
|
149
|
+
vertex: Vertex;
|
|
150
|
+
fontSize?: number;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* 全景标签枚举
|
|
154
|
+
*/
|
|
155
|
+
export declare enum PanoTagEnum {
|
|
156
|
+
Text = "Text",
|
|
157
|
+
Image = "Image"
|
|
158
|
+
}
|
|
159
|
+
export declare type PanoTagData = {
|
|
160
|
+
type: PanoTagEnum;
|
|
161
|
+
text: string;
|
|
162
|
+
vertex: Vertex;
|
|
163
|
+
imgUrl?: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* 全景特效枚举
|
|
167
|
+
*/
|
|
168
|
+
export declare enum PanoEffectEnum {
|
|
169
|
+
/**
|
|
170
|
+
* 两点距离
|
|
171
|
+
*/
|
|
172
|
+
Distance = "Distance"
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 全景特效
|
|
176
|
+
*/
|
|
177
|
+
export declare type PanoEffectData = {
|
|
178
|
+
effect: PanoEffectEnum;
|
|
179
|
+
twoVertexs: [Vertex, Vertex];
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* 信息面板类型枚举
|
|
183
|
+
*/
|
|
184
|
+
export declare enum InfoPanelTypeEnum {
|
|
185
|
+
Image = "Image",
|
|
186
|
+
Video = "Video"
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 信息面板
|
|
190
|
+
*/
|
|
191
|
+
export declare type InfoPanelData = {
|
|
192
|
+
type: InfoPanelTypeEnum;
|
|
193
|
+
url: string;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* 视频特效
|
|
197
|
+
*/
|
|
198
|
+
export declare type VideoEffectData = {
|
|
199
|
+
videoSrc: string;
|
|
200
|
+
panoIndex: number;
|
|
201
|
+
fov: number;
|
|
202
|
+
direction?: Vertex;
|
|
203
|
+
vector?: Pick<Pose, 'longitude' | 'latitude'>;
|
|
204
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = void 0;
|
|
7
|
+
var VreoKeyframeEnum;
|
|
8
|
+
/**
|
|
9
|
+
* 支持自定义剧本关键帧配置项
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
exports.VreoKeyframeEnum = VreoKeyframeEnum;
|
|
13
|
+
|
|
14
|
+
(function (VreoKeyframeEnum) {
|
|
15
|
+
VreoKeyframeEnum["CameraMovement"] = "CameraMovement";
|
|
16
|
+
VreoKeyframeEnum["PanoTag"] = "PanoTag";
|
|
17
|
+
VreoKeyframeEnum["PanoTextLabel"] = "PanoTextLabel";
|
|
18
|
+
VreoKeyframeEnum["Prompter"] = "Prompter";
|
|
19
|
+
VreoKeyframeEnum["UpdateVRPanorama"] = "UpdateVRPanorama";
|
|
20
|
+
VreoKeyframeEnum["ModelVideo"] = "ModelVideo";
|
|
21
|
+
VreoKeyframeEnum["PanoEffect"] = "PanoEffect";
|
|
22
|
+
VreoKeyframeEnum["InfoPanel"] = "InfoPanel";
|
|
23
|
+
VreoKeyframeEnum["VideoEffect"] = "VideoEffect";
|
|
24
|
+
VreoKeyframeEnum["Exit"] = "Exit";
|
|
25
|
+
})(VreoKeyframeEnum || (exports.VreoKeyframeEnum = VreoKeyframeEnum = {}));
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 全景标签枚举
|
|
29
|
+
*/
|
|
30
|
+
var PanoTagEnum;
|
|
31
|
+
exports.PanoTagEnum = PanoTagEnum;
|
|
32
|
+
|
|
33
|
+
(function (PanoTagEnum) {
|
|
34
|
+
PanoTagEnum["Text"] = "Text";
|
|
35
|
+
PanoTagEnum["Image"] = "Image";
|
|
36
|
+
})(PanoTagEnum || (exports.PanoTagEnum = PanoTagEnum = {}));
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 全景特效枚举
|
|
40
|
+
*/
|
|
41
|
+
var PanoEffectEnum;
|
|
42
|
+
/**
|
|
43
|
+
* 全景特效
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
exports.PanoEffectEnum = PanoEffectEnum;
|
|
47
|
+
|
|
48
|
+
(function (PanoEffectEnum) {
|
|
49
|
+
PanoEffectEnum["Distance"] = "Distance";
|
|
50
|
+
})(PanoEffectEnum || (exports.PanoEffectEnum = PanoEffectEnum = {}));
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 信息面板类型枚举
|
|
54
|
+
*/
|
|
55
|
+
var InfoPanelTypeEnum;
|
|
56
|
+
/**
|
|
57
|
+
* 信息面板
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
|
|
61
|
+
|
|
62
|
+
(function (InfoPanelTypeEnum) {
|
|
63
|
+
InfoPanelTypeEnum["Image"] = "Image";
|
|
64
|
+
InfoPanelTypeEnum["Video"] = "Video";
|
|
65
|
+
})(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@realsee/vreo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"author": "BEIKE REALSEE TECHNOLOGY (HK) LIMITED",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": false,
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"resources",
|
|
12
|
+
"docs",
|
|
13
|
+
"stylesheets",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "vite --port=3088",
|
|
18
|
+
"build": "tsc && vite build",
|
|
19
|
+
"preview": "vite preview",
|
|
20
|
+
"docs": "npx typedoc",
|
|
21
|
+
"packages": "node ./dev-tools/build-packages.js"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@realsee/five": "^5.0.0-alpha.53",
|
|
25
|
+
"react": "^16.0.0",
|
|
26
|
+
"react-dom": "^16.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@babel/cli": "^7.16.0",
|
|
30
|
+
"@babel/core": "^7.16.0",
|
|
31
|
+
"@babel/preset-env": "^7.16.4",
|
|
32
|
+
"@babel/preset-react": "^7.16.0",
|
|
33
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
34
|
+
"@realsee/five": "^5.0.0-alpha.57",
|
|
35
|
+
"@types/offscreencanvas": "^2019.6.4",
|
|
36
|
+
"@types/react": "^17.0.37",
|
|
37
|
+
"@types/react-dom": "^17.0.11",
|
|
38
|
+
"@types/react-transition-group": "^4.4.4",
|
|
39
|
+
"@vitejs/plugin-react": "^1.1.0",
|
|
40
|
+
"del": "^6.0.0",
|
|
41
|
+
"react": "^16.0.0",
|
|
42
|
+
"react-dom": "^16.0.0",
|
|
43
|
+
"three": "^0.117.1",
|
|
44
|
+
"typedoc": "^0.22.10",
|
|
45
|
+
"typescript": "^4.5.2",
|
|
46
|
+
"vite": "^2.6.14"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@tweenjs/tween.js": "18.6.4",
|
|
50
|
+
"classnames": "^2.3.1",
|
|
51
|
+
"mobx": "^6.3.7",
|
|
52
|
+
"mobx-react": "^7.2.1",
|
|
53
|
+
"react-transition-group": "^4.4.2"
|
|
54
|
+
}
|
|
55
|
+
}
|