@realsee/vreo 0.2.0-alpha.2 → 0.2.0-alpha.20

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.
Files changed (147) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +80 -5
  3. package/docs/assets/custom.css +2 -2
  4. package/docs/assets/highlight.css +1 -1
  5. package/docs/assets/main.js +2 -2
  6. package/docs/assets/search.js +1 -1
  7. package/docs/assets/style.css +28 -2
  8. package/docs/classes/Player.AudioLike.html +52 -0
  9. package/docs/classes/Player.Controller.html +13 -13
  10. package/docs/classes/Player.Player-1.html +11 -11
  11. package/docs/classes/Player.VideoAgentMesh.html +53 -53
  12. package/docs/classes/Player.VideoAgentScene.html +1 -1
  13. package/docs/demo/assets/AppReact.ec0a6e82.js +1 -0
  14. package/docs/demo/assets/default.55c3f308.css +1 -0
  15. package/docs/demo/assets/default.a5d6dd99.js +3952 -0
  16. package/docs/demo/assets/dynamic.8c30b7ae.js +1 -0
  17. package/docs/demo/assets/examples.dac4a6fe.css +1 -0
  18. package/docs/demo/assets/examples.ddb41c97.js +25 -0
  19. package/docs/demo/assets/index.a7bafdff.css +1 -0
  20. package/docs/demo/assets/index.fc42be2b.js +1 -0
  21. package/docs/demo/assets/main.d119ebf7.js +1 -0
  22. package/docs/demo/assets/react.2d403aee.js +25 -0
  23. package/docs/demo/assets/react.855b3d23.css +1 -0
  24. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
  25. package/docs/demo/examples.html +17 -0
  26. package/docs/demo/index-react-dynamic.html +20 -0
  27. package/docs/demo/index-react.html +20 -0
  28. package/docs/demo/index.html +19 -0
  29. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -0
  30. package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
  31. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  32. package/docs/enums/Player.PanoTagEnum.html +2 -2
  33. package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
  34. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  35. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  36. package/docs/enums/fivePlugins.Rotation.html +1 -1
  37. package/docs/index.html +37 -6
  38. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  39. package/docs/interfaces/Player.PlayerConfigs.html +3 -3
  40. package/docs/interfaces/Player.Vertex.html +2 -2
  41. package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
  42. package/docs/interfaces/Player.VreoKeyframe.html +2 -2
  43. package/docs/interfaces/Player.VreoUnit.html +2 -2
  44. package/docs/interfaces/Player.VreoVideo.html +2 -2
  45. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
  46. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  47. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  48. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  49. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  50. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  51. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  52. package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
  53. package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
  54. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  55. package/docs/modules/Player.html +21 -15
  56. package/docs/modules/custom.html +1 -1
  57. package/docs/modules/fivePlugins.html +5 -2
  58. package/docs/modules/react.html +1 -1
  59. package/docs/modules.html +1 -1
  60. package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
  61. package/lib/PlayController/createHTMLAudioElement.js +47 -0
  62. package/lib/PlayController/index.d.ts +38 -0
  63. package/lib/PlayController/index.js +300 -0
  64. package/lib/Player/App.js +5 -4
  65. package/lib/Player/Controller.d.ts +5 -1
  66. package/lib/Player/Controller.js +38 -5
  67. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  68. package/lib/Player/custom/SpatialScenePanel/index.js +98 -26
  69. package/lib/Player/index.d.ts +3 -2
  70. package/lib/Player/index.js +116 -24
  71. package/lib/Player/modules/Drawer/index.js +1 -1
  72. package/lib/Player/modules/PopUp/index.d.ts +2 -0
  73. package/lib/Player/modules/PopUp/index.js +43 -0
  74. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +17 -2
  75. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +113 -37
  76. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +5 -1
  77. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +9 -4
  78. package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
  79. package/lib/Player/modules/VideoAgent/index.js +2 -2
  80. package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
  81. package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -6
  82. package/lib/Player/modules/keyframes/InfoPanel/index.js +74 -36
  83. package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
  84. package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
  85. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
  86. package/lib/Player/modules/keyframes/PanoTag/index.js +20 -7
  87. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
  88. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -51
  89. package/lib/Player/modules/keyframes/Prompter/index.js +5 -19
  90. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +31 -19
  91. package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
  92. package/lib/Player/typings.d.ts +6 -0
  93. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
  94. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
  95. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
  96. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
  97. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
  98. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
  99. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
  100. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
  101. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
  102. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
  103. package/lib/fivePlugins/CameraMovementPlugin/index.js +104 -90
  104. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +1 -0
  105. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
  106. package/lib/react/index.d.ts +7 -3
  107. package/lib/react/index.js +3 -3
  108. package/lib/shared-utils/AduioLike.d.ts +37 -0
  109. package/lib/shared-utils/AduioLike.js +165 -0
  110. package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
  111. package/lib/shared-utils/animationFrame/tween.js +1 -1
  112. package/lib/shared-utils/createTransMatrix.d.ts +1 -0
  113. package/lib/shared-utils/createTransMatrix.js +43 -0
  114. package/lib/typings/VreoUnit.d.ts +42 -5
  115. package/lib/typings/VreoUnit.js +26 -6
  116. package/package.json +8 -8
  117. package/resources/PlayController/createHTMLAudioElement.ts +53 -0
  118. package/resources/PlayController/index.ts +167 -0
  119. package/resources/Player/App.tsx +2 -0
  120. package/resources/Player/Controller.ts +155 -121
  121. package/resources/Player/custom/SpatialScenePanel/index.tsx +148 -45
  122. package/resources/Player/index.tsx +186 -110
  123. package/resources/Player/modules/PopUp/index.tsx +26 -0
  124. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +66 -14
  125. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +3 -3
  126. package/resources/Player/modules/VideoAgent/index.tsx +3 -2
  127. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
  128. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +79 -34
  129. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
  130. package/resources/Player/modules/keyframes/PanoTag/index.tsx +31 -12
  131. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +87 -34
  132. package/resources/Player/modules/keyframes/Prompter/index.tsx +5 -15
  133. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +25 -16
  134. package/resources/Player/typings.ts +5 -0
  135. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
  136. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
  137. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
  138. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
  139. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
  140. package/resources/fivePlugins/CameraMovementPlugin/index.ts +59 -48
  141. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
  142. package/resources/react/index.tsx +7 -3
  143. package/resources/shared-utils/AduioLike.ts +108 -0
  144. package/resources/shared-utils/createTransMatrix.ts +12 -0
  145. package/resources/typings/VreoUnit.ts +46 -5
  146. package/stylesheets/custom/SpatialScenePanel.css +14 -8
  147. package/stylesheets/default.css +116 -12
@@ -0,0 +1,37 @@
1
+ import { Subscribe } from '@realsee/five';
2
+ /**
3
+ * 模拟 `<Audio>` 事件。
4
+ */
5
+ export declare type AudioLikeEvent = {
6
+ play: () => void;
7
+ pause: () => void;
8
+ timeupdate: () => void;
9
+ ended: () => void;
10
+ };
11
+ /**
12
+ * 模拟 `<Audio>` 功能:没有音频,但执行逻辑跟 `<Audio>` 相似。
13
+ */
14
+ export declare class AudioLike extends Subscribe<AudioLikeEvent> {
15
+ private $timestamp;
16
+ private $currentTime;
17
+ private $duration;
18
+ private stopInterval?;
19
+ muted: boolean;
20
+ src: string;
21
+ setAttribute(name: string, value: string): void;
22
+ constructor({ duration }?: {
23
+ duration?: number;
24
+ });
25
+ play(): void;
26
+ pause(): void;
27
+ requestAnimationFrameLoop(): void;
28
+ get currentTime(): number;
29
+ set currentTime(time: number);
30
+ get duration(): number;
31
+ set duration(duration: number);
32
+ get ended(): boolean;
33
+ get paused(): boolean;
34
+ addEventListener(evtName: keyof AudioLikeEvent, callback: () => void, useCapture?: boolean): void;
35
+ removeEventListener(evtName: keyof AudioLikeEvent, callback: () => void, useCapture?: boolean): void;
36
+ }
37
+ export default AudioLike;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.AudioLike = void 0;
9
+
10
+ var _five = require("@realsee/five");
11
+
12
+ var _animationFrame = require("./animationFrame");
13
+
14
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
+
16
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
+
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+
20
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
+
22
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
+
24
+ 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); }; }
25
+
26
+ 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); }
27
+
28
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
+
30
+ 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; } }
31
+
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
+
34
+ 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; }
35
+
36
+ /**
37
+ * 模拟 `<Audio>` 功能:没有音频,但执行逻辑跟 `<Audio>` 相似。
38
+ */
39
+ var AudioLike = /*#__PURE__*/function (_Subscribe) {
40
+ _inherits(AudioLike, _Subscribe);
41
+
42
+ var _super = _createSuper(AudioLike);
43
+
44
+ function AudioLike() {
45
+ var _this;
46
+
47
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
48
+ duration = _ref.duration;
49
+
50
+ _classCallCheck(this, AudioLike);
51
+
52
+ _this = _super.call(this);
53
+
54
+ _defineProperty(_assertThisInitialized(_this), "$timestamp", 0);
55
+
56
+ _defineProperty(_assertThisInitialized(_this), "$currentTime", 0);
57
+
58
+ _defineProperty(_assertThisInitialized(_this), "$duration", 0);
59
+
60
+ _defineProperty(_assertThisInitialized(_this), "muted", false);
61
+
62
+ _defineProperty(_assertThisInitialized(_this), "src", '');
63
+
64
+ if (duration) {
65
+ _this.$duration = duration;
66
+ }
67
+
68
+ return _this;
69
+ }
70
+
71
+ _createClass(AudioLike, [{
72
+ key: "setAttribute",
73
+ value: function setAttribute(name, value) {// nothing todo
74
+ }
75
+ }, {
76
+ key: "play",
77
+ value: function play() {
78
+ var _this2 = this;
79
+
80
+ if (this.$timestamp === 0) {
81
+ this.$timestamp = performance.now();
82
+ }
83
+
84
+ if (this.$currentTime === this.$duration) {
85
+ this.$currentTime = 0;
86
+ }
87
+
88
+ this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
89
+ return _this2.requestAnimationFrameLoop();
90
+ });
91
+ this.emit('play');
92
+ }
93
+ }, {
94
+ key: "pause",
95
+ value: function pause() {
96
+ if (this.stopInterval) {
97
+ this.stopInterval();
98
+ this.emit('pause');
99
+ this.stopInterval = undefined;
100
+ }
101
+
102
+ this.$timestamp = 0;
103
+ }
104
+ }, {
105
+ key: "requestAnimationFrameLoop",
106
+ value: function requestAnimationFrameLoop() {
107
+ var now = performance.now();
108
+ this.$currentTime = now - this.$timestamp;
109
+ this.emit('timeupdate');
110
+
111
+ if (this.$currentTime >= this.$duration - 10) {
112
+ this.$currentTime = this.$duration;
113
+ this.pause();
114
+ this.emit('ended');
115
+ }
116
+ }
117
+ }, {
118
+ key: "currentTime",
119
+ get: function get() {
120
+ return this.$currentTime / 1000;
121
+ },
122
+ set: function set(time) {
123
+ this.$currentTime = time;
124
+ }
125
+ }, {
126
+ key: "duration",
127
+ get: function get() {
128
+ return this.$duration;
129
+ },
130
+ set: function set(duration) {
131
+ this.pause();
132
+ this.$duration = duration;
133
+ this.$timestamp = 0;
134
+ this.$currentTime = 0;
135
+ }
136
+ }, {
137
+ key: "ended",
138
+ get: function get() {
139
+ return this.$currentTime === this.$duration;
140
+ }
141
+ }, {
142
+ key: "paused",
143
+ get: function get() {
144
+ return !this.stopInterval;
145
+ }
146
+ }, {
147
+ key: "addEventListener",
148
+ value: function addEventListener(evtName, callback) {
149
+ var useCapture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
150
+ this.on(evtName, callback);
151
+ }
152
+ }, {
153
+ key: "removeEventListener",
154
+ value: function removeEventListener(evtName, callback) {
155
+ var useCapture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
156
+ this.off(evtName, callback);
157
+ }
158
+ }]);
159
+
160
+ return AudioLike;
161
+ }(_five.Subscribe);
162
+
163
+ exports.AudioLike = AudioLike;
164
+ var _default = AudioLike;
165
+ exports["default"] = _default;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -14,9 +14,13 @@ var _ = require(".");
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
16
16
 
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
18
+
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+
17
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
22
 
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); }
23
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
24
 
21
25
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
26
 
@@ -84,7 +88,7 @@ var BetterTween = /*#__PURE__*/function (_TWEEN$Tween) {
84
88
  return _this;
85
89
  }
86
90
 
87
- return BetterTween;
91
+ return _createClass(BetterTween);
88
92
  }(_tween["default"].Tween);
89
93
 
90
94
  exports.BetterTween = BetterTween;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ export declare function createTransMatrix(arr1: number[]): (arr2: number[]) => number[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createTransMatrix = createTransMatrix;
9
+
10
+ var THREE = _interopRequireWildcard(require("three"));
11
+
12
+ 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); }
13
+
14
+ 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; }
15
+
16
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
17
+
18
+ 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; } }
19
+
20
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
+
22
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
+
24
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+
26
+ 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); }
27
+
28
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
29
+
30
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 createTransMatrix(arr1) {
35
+ var matrix4 = new THREE.Matrix4();
36
+ matrix4.fromArray(arr1);
37
+ return function (arr2) {
38
+ var vector3 = _construct(THREE.Vector3, _toConsumableArray(arr2));
39
+
40
+ vector3.applyMatrix4(matrix4);
41
+ return vector3.toArray();
42
+ };
43
+ }
@@ -61,7 +61,7 @@ export declare type VreoKeyframeConfigMap = {
61
61
  * 剧本关键帧
62
62
  */
63
63
  export interface VreoKeyframe {
64
- uuid: string;
64
+ uuid?: string;
65
65
  type: VreoKeyframeEnum;
66
66
  start: number;
67
67
  end: number;
@@ -95,15 +95,17 @@ export declare type VreoKeyframeEvent = {
95
95
  [key in VreoKeyframeEnum]: (keyframe: VreoKeyframe) => void;
96
96
  } & {
97
97
  loaded: (vreoUnit: VreoUnit) => void;
98
- paused: () => void;
98
+ paused: (ended?: boolean) => void;
99
99
  playing: () => void;
100
100
  unknownKeyframeType: (keyframe: Record<string, any>) => void;
101
+ ended: () => void;
101
102
  };
102
103
  /**
103
104
  * 相机运动
104
105
  */
105
106
  export declare type CameraMovementData = {
106
- effect: CameraMovementEffect;
107
+ effect?: CameraMovementEffect;
108
+ transEffect?: "fly" | "fade" | "instant";
107
109
  mode: Mode;
108
110
  panoIndex: number;
109
111
  loop?: boolean;
@@ -146,9 +148,13 @@ export interface Vertex {
146
148
  z: number;
147
149
  }
148
150
  /**
149
- * 四个顶点元组
151
+ * 矩形顶点
150
152
  */
151
153
  export declare type QuadrangleVertexs = [Vertex, Vertex, Vertex, Vertex];
154
+ /**
155
+ * 顶点数组
156
+ */
157
+ export declare type Vertexs = Vertex[];
152
158
  /**
153
159
  * 视频广告
154
160
  */
@@ -164,7 +170,17 @@ export declare type ModelVideoData = {
164
170
  /**
165
171
  * 视频映射在模型中的顶点
166
172
  */
167
- vertexs: QuadrangleVertexs;
173
+ vertexs: QuadrangleVertexs | Vertexs;
174
+ matrixWorld?: number[];
175
+ };
176
+ /**
177
+ * 四元数
178
+ */
179
+ export declare type Quaternion = {
180
+ x: number;
181
+ y: number;
182
+ z: number;
183
+ w: number;
168
184
  };
169
185
  /**
170
186
  * 全景文本标签
@@ -172,6 +188,8 @@ export declare type ModelVideoData = {
172
188
  export declare type PanoTextLabelData = {
173
189
  text: string;
174
190
  vertex: Vertex;
191
+ normal?: Vertex;
192
+ quaternion?: Quaternion;
175
193
  fontSize?: number;
176
194
  };
177
195
  /**
@@ -181,8 +199,22 @@ export declare enum PanoTagEnum {
181
199
  Text = "Text",
182
200
  Image = "Image"
183
201
  }
202
+ /**
203
+ * 标签样式种类
204
+ */
205
+ export declare enum PanoTagStyleEnum {
206
+ /**
207
+ * 生长动画:默认值
208
+ */
209
+ Growth = "Growth",
210
+ /**
211
+ * 展开动画
212
+ */
213
+ Expand = "Expand"
214
+ }
184
215
  export declare type PanoTagData = {
185
216
  type: PanoTagEnum;
217
+ style: PanoTagStyleEnum;
186
218
  text: string;
187
219
  vertex: Vertex;
188
220
  imgUrl?: string;
@@ -210,11 +242,16 @@ export declare enum InfoPanelTypeEnum {
210
242
  Image = "Image",
211
243
  Video = "Video"
212
244
  }
245
+ export declare enum InfoPanelStyleEnum {
246
+ Drawer = "Drawer",
247
+ PopUp = "PopUp"
248
+ }
213
249
  /**
214
250
  * 信息面板
215
251
  */
216
252
  export declare type InfoPanelData = {
217
253
  type: InfoPanelTypeEnum;
254
+ style?: InfoPanelStyleEnum;
218
255
  url: string;
219
256
  title?: string;
220
257
  subTitle?: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = void 0;
6
+ exports.VreoKeyframeEnum = exports.PanoTagStyleEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = exports.InfoPanelStyleEnum = void 0;
7
7
  var VreoKeyframeEnum;
8
8
  /**
9
9
  * 支持自定义剧本关键帧配置项
@@ -30,6 +30,10 @@ exports.VreoKeyframeEnum = VreoKeyframeEnum;
30
30
  * 全景标签枚举
31
31
  */
32
32
  var PanoTagEnum;
33
+ /**
34
+ * 标签样式种类
35
+ */
36
+
33
37
  exports.PanoTagEnum = PanoTagEnum;
34
38
 
35
39
  (function (PanoTagEnum) {
@@ -37,6 +41,14 @@ exports.PanoTagEnum = PanoTagEnum;
37
41
  PanoTagEnum["Image"] = "Image";
38
42
  })(PanoTagEnum || (exports.PanoTagEnum = PanoTagEnum = {}));
39
43
 
44
+ var PanoTagStyleEnum;
45
+ exports.PanoTagStyleEnum = PanoTagStyleEnum;
46
+
47
+ (function (PanoTagStyleEnum) {
48
+ PanoTagStyleEnum["Growth"] = "Growth";
49
+ PanoTagStyleEnum["Expand"] = "Expand";
50
+ })(PanoTagStyleEnum || (exports.PanoTagStyleEnum = PanoTagStyleEnum = {}));
51
+
40
52
  /**
41
53
  * 全景特效枚举
42
54
  */
@@ -55,13 +67,21 @@ exports.PanoEffectEnum = PanoEffectEnum;
55
67
  * 信息面板类型枚举
56
68
  */
57
69
  var InfoPanelTypeEnum;
58
- /**
59
- * 信息面板
60
- */
61
-
62
70
  exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
63
71
 
64
72
  (function (InfoPanelTypeEnum) {
65
73
  InfoPanelTypeEnum["Image"] = "Image";
66
74
  InfoPanelTypeEnum["Video"] = "Video";
67
- })(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
75
+ })(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
76
+
77
+ var InfoPanelStyleEnum;
78
+ /**
79
+ * 信息面板
80
+ */
81
+
82
+ exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
83
+
84
+ (function (InfoPanelStyleEnum) {
85
+ InfoPanelStyleEnum["Drawer"] = "Drawer";
86
+ InfoPanelStyleEnum["PopUp"] = "PopUp";
87
+ })(InfoPanelStyleEnum || (exports.InfoPanelStyleEnum = InfoPanelStyleEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "0.2.0-alpha.2",
3
+ "version": "0.2.0-alpha.20",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",
@@ -15,19 +15,20 @@
15
15
  "resources",
16
16
  "docs",
17
17
  "stylesheets",
18
- "LICENSE"
18
+ "LICENSE",
19
+ "CHANGELOG.md"
19
20
  ],
20
21
  "scripts": {
21
- "dev": "vite --port=3088",
22
+ "dev": "vite --port=3088 --host 0.0.0.0",
22
23
  "build": "tsc && vite build",
23
24
  "preview": "vite preview",
24
- "docs": "npx typedoc",
25
+ "docs": "npx typedoc && yarn run build",
25
26
  "packages": "node ./dev-tools/build-packages.js"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "@realsee/five": "^5.0.0-alpha.103",
29
- "react": "^16.0.0",
30
- "react-dom": "^16.0.0"
30
+ "react": "^17.0.0",
31
+ "react-dom": "^17.0.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@babel/cli": "^7.16.0",
@@ -54,7 +55,6 @@
54
55
  "@tweenjs/tween.js": "18.6.4",
55
56
  "classnames": "^2.3.1",
56
57
  "mobx": "^6.3.7",
57
- "mobx-react": "^7.2.1",
58
- "react-transition-group": "^4.4.2"
58
+ "mobx-react": "^7.2.1"
59
59
  }
60
60
  }
@@ -0,0 +1,53 @@
1
+
2
+ const BLANK_AUDIO = ''
3
+ + 'data:audio/mpeg;base64,'
4
+ + '//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVV'
5
+ + 'VVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////'
6
+ + '////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAA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VVVVV'
32
+ + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV'
33
+ + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=';
34
+
35
+
36
+ export function createHTMLAudioElement(): HTMLAudioElement {
37
+ const ndAudio = document.querySelector('#vreo-playController-audio')
38
+ if (ndAudio) {
39
+ return ndAudio as HTMLAudioElement
40
+ }
41
+
42
+ const audio = document.createElement('audio')
43
+ audio.style.display = 'none'
44
+ audio.setAttribute('id', 'vreo-playController-audio')
45
+ audio.controls = false
46
+ document.body.appendChild(audio)
47
+ audio.src = BLANK_AUDIO
48
+
49
+ // 触发一次播放
50
+ Promise.resolve(async () => await audio.play())
51
+
52
+ return audio
53
+ }