@realsee/vreo 0.2.0-alpha.9 → 1.0.0-alpha.2
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/CHANGELOG.md +30 -0
- package/README.md +16 -5
- package/docs/assets/highlight.css +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +28 -2
- package/docs/classes/Player.AudioLike.html +52 -0
- package/docs/classes/Player.Controller.html +13 -13
- package/docs/classes/Player.Player-1.html +11 -11
- package/docs/classes/Player.VideoAgentMesh.html +53 -53
- package/docs/classes/Player.VideoAgentScene.html +1 -1
- package/docs/demo/assets/AppReact.d0ee843a.js +1 -0
- package/docs/demo/assets/default.63925584.js +3984 -0
- package/docs/demo/assets/default.f3f3ca8c.css +1 -0
- package/docs/demo/assets/dynamic.76506c2c.js +1 -0
- package/docs/demo/assets/examples.3d8323db.js +25 -0
- package/docs/demo/assets/examples.dac4a6fe.css +1 -0
- package/docs/demo/assets/index.7e31122c.js +1 -0
- package/docs/demo/assets/index.9331038f.css +1 -0
- package/docs/demo/assets/main.79b11b9d.js +1 -0
- package/docs/demo/assets/react.2ee8565f.css +1 -0
- package/docs/demo/assets/react.c1c07c14.js +25 -0
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
- package/docs/demo/examples.html +17 -0
- package/docs/demo/index-react-dynamic.html +20 -0
- package/docs/demo/index-react.html +20 -0
- package/docs/demo/index.html +19 -0
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
- package/docs/enums/Player.PanoEffectEnum.html +2 -2
- package/docs/enums/Player.PanoTagEnum.html +2 -2
- package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
- package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +13 -6
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +4 -3
- package/docs/interfaces/Player.Vertex.html +2 -2
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
- package/docs/interfaces/Player.VreoKeyframe.html +2 -2
- package/docs/interfaces/Player.VreoUnit.html +2 -2
- package/docs/interfaces/Player.VreoVideo.html +2 -2
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
- package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
- package/docs/interfaces/react.VreoProviderProps.html +1 -1
- package/docs/modules/Player.html +21 -15
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +5 -2
- package/docs/modules/react.html +1 -1
- package/docs/modules.html +1 -1
- package/lib/PlayController/index.js +4 -5
- package/lib/Player/App.js +9 -7
- package/lib/Player/Controller.d.ts +29 -8
- package/lib/Player/Controller.js +193 -27
- package/lib/Player/custom/SpatialScenePanel/index.js +5 -4
- package/lib/Player/hooks.js +2 -2
- package/lib/Player/index.d.ts +5 -3
- package/lib/Player/index.js +97 -53
- package/lib/Player/modules/Drawer/index.js +1 -1
- package/lib/Player/modules/PopUp/index.js +1 -1
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
- package/lib/Player/modules/ResizeObserver/index.js +37 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +16 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +132 -59
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -6
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +31 -36
- package/lib/Player/modules/VideoAgent/index.js +53 -12
- package/lib/Player/modules/Wave/index.d.ts +5 -0
- package/lib/Player/modules/Wave/index.js +51 -0
- package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.js +1 -1
- package/lib/Player/modules/keyframes/InfoPanel/index.js +22 -10
- package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
- package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
- package/lib/Player/modules/keyframes/PanoTag/index.js +79 -119
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -44
- package/lib/Player/modules/keyframes/Prompter/index.js +10 -23
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +10 -6
- package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
- package/lib/Player/typings.d.ts +12 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +13 -12
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
- package/lib/react/index.d.ts +8 -4
- package/lib/react/index.js +3 -3
- package/lib/shared-utils/AduioLike.d.ts +37 -0
- package/lib/shared-utils/AduioLike.js +166 -0
- package/lib/shared-utils/addResizeListener.d.ts +4 -0
- package/lib/shared-utils/addResizeListener.js +51 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
- package/lib/shared-utils/animationFrame/tween.js +1 -1
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +43 -0
- package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
- package/lib/shared-utils/getFileExpandedName.js +13 -0
- package/lib/shared-utils/getMediaInfo.d.ts +9 -0
- package/lib/shared-utils/getMediaInfo.js +75 -0
- package/lib/shared-utils/setElementDataset.d.ts +1 -0
- package/lib/shared-utils/setElementDataset.js +24 -0
- package/lib/typings/VreoUnit.d.ts +37 -2
- package/lib/typings/VreoUnit.js +13 -1
- package/package.json +10 -10
- package/resources/PlayController/index.ts +0 -13
- package/resources/Player/App.tsx +5 -4
- package/resources/Player/Controller.ts +277 -146
- package/resources/Player/custom/SpatialScenePanel/index.tsx +5 -5
- package/resources/Player/hooks.ts +3 -5
- package/resources/Player/index.tsx +189 -141
- package/resources/Player/modules/ResizeObserver/index.tsx +23 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +87 -31
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +27 -24
- package/resources/Player/modules/VideoAgent/index.tsx +28 -12
- package/resources/Player/modules/Wave/index.tsx +18 -0
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +26 -11
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +53 -97
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +86 -34
- package/resources/Player/modules/keyframes/Prompter/index.tsx +6 -16
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +6 -2
- package/resources/Player/typings.ts +15 -1
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +19 -12
- package/resources/react/index.tsx +7 -3
- package/resources/shared-utils/AduioLike.ts +109 -0
- package/resources/shared-utils/addResizeListener.ts +46 -0
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/shared-utils/getFileExpandedName.ts +6 -0
- package/resources/shared-utils/getMediaInfo.ts +52 -0
- package/resources/shared-utils/setElementDataset.ts +18 -0
- package/resources/typings/VreoUnit.ts +41 -3
- package/stylesheets/custom/SpatialScenePanel.css +2 -1
- package/stylesheets/default.css +348 -84
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/vreo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
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
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": "^
|
|
30
|
-
"react-dom": "^
|
|
30
|
+
"react": "^17.0.0",
|
|
31
|
+
"react-dom": "^17.0.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@babel/cli": "^7.16.0",
|
|
@@ -35,8 +36,8 @@
|
|
|
35
36
|
"@babel/preset-env": "^7.16.4",
|
|
36
37
|
"@babel/preset-react": "^7.16.0",
|
|
37
38
|
"@babel/preset-typescript": "^7.16.0",
|
|
38
|
-
"@realsee/dnalogel": "^
|
|
39
|
-
"@realsee/five": "
|
|
39
|
+
"@realsee/dnalogel": "^2.1.0-alpha.17",
|
|
40
|
+
"@realsee/five": "5.0.0-alpha.149",
|
|
40
41
|
"@types/offscreencanvas": "^2019.6.4",
|
|
41
42
|
"@types/react": "^17.0.37",
|
|
42
43
|
"@types/react-dom": "^17.0.11",
|
|
@@ -47,14 +48,13 @@
|
|
|
47
48
|
"react-dom": "^16.0.0",
|
|
48
49
|
"three": "^0.117.1",
|
|
49
50
|
"typedoc": "^0.22.10",
|
|
50
|
-
"typescript": "
|
|
51
|
+
"typescript": "4.7.4",
|
|
51
52
|
"vite": "^2.6.14"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
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
|
}
|
|
@@ -152,16 +152,3 @@ export class PlayController extends Subscribe<VreoKeyframeEvent> {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
console.log(`
|
|
157
|
-
|
|
158
|
-
┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━
|
|
159
|
-
┃┏━┓┃━━━━━━━━━┃┃━━━━━━━━━━━━━
|
|
160
|
-
┃┗━┛┃┏━━┓┏━━┓━┃┃━┏━━┓┏━━┓┏━━┓
|
|
161
|
-
┃┏┓┏┛┃┏┓┃┗━┓┃━┃┃━┃━━┫┃┏┓┃┃┏┓┃
|
|
162
|
-
┃┃┃┗┓┃┃━┫┃┗┛┗┓┃┗┓┣━━┃┃┃━┫┃┃━┫
|
|
163
|
-
┗┛┗━┛┗━━┛┗━━━┛┗━┛┗━━┛┗━━┛┗━━┛
|
|
164
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
165
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
166
|
-
|
|
167
|
-
`)
|
package/resources/Player/App.tsx
CHANGED
|
@@ -2,8 +2,9 @@ import * as React from 'react'
|
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { observer } from 'mobx-react'
|
|
4
4
|
import { Controller } from './Controller'
|
|
5
|
-
import { useController
|
|
5
|
+
import { useController } from './hooks'
|
|
6
6
|
import { CameraMovement } from './modules/keyframes/CameraMovement'
|
|
7
|
+
import { ResizeObserver } from './modules/ResizeObserver'
|
|
7
8
|
import { InfoPanel } from './modules/keyframes/InfoPanel'
|
|
8
9
|
import { ModelVideo } from './modules/keyframes/ModelVideo'
|
|
9
10
|
import { PanoEffect } from './modules/keyframes/PanoEffect'
|
|
@@ -14,6 +15,7 @@ import { UpdateVRPanorama } from './modules/keyframes/UpdateVRPanorama'
|
|
|
14
15
|
import { VideoEffect } from './modules/keyframes/VideoEffect'
|
|
15
16
|
import { VideoAgent } from './modules/VideoAgent'
|
|
16
17
|
import { BgMusic } from './modules/keyframes/BgMusic'
|
|
18
|
+
import { Wave } from './modules/Wave'
|
|
17
19
|
|
|
18
20
|
const AppView = observer(({ controller }: { controller: Controller }) => {
|
|
19
21
|
|
|
@@ -24,11 +26,9 @@ const AppView = observer(({ controller }: { controller: Controller }) => {
|
|
|
24
26
|
})}
|
|
25
27
|
>
|
|
26
28
|
<div className="vreo-panel-inner">
|
|
29
|
+
{controller.waveAppearance && <Wave appearance={controller.waveAppearance}/>}
|
|
27
30
|
<VideoAgent
|
|
28
31
|
onClick={() => {
|
|
29
|
-
if (controller.isAudio) {
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
32
|
if (controller.playing) {
|
|
33
33
|
controller.setPlaying(false)
|
|
34
34
|
} else {
|
|
@@ -49,6 +49,7 @@ export function App() {
|
|
|
49
49
|
return (
|
|
50
50
|
<>
|
|
51
51
|
<>
|
|
52
|
+
<ResizeObserver />
|
|
52
53
|
<CameraMovement />
|
|
53
54
|
<ModelVideo />
|
|
54
55
|
<UpdateVRPanorama />
|
|
@@ -2,165 +2,296 @@ import { Five, Subscribe } from '@realsee/five'
|
|
|
2
2
|
import { action, computed, makeObservable, observable, reaction } from 'mobx'
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { requestAnimationFrameInterval } from '../shared-utils/animationFrame'
|
|
5
|
-
import { VreoKeyframe, VreoKeyframeEnum, VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit'
|
|
5
|
+
import { VreoKeyframe, VreoKeyframeEnum, VreoKeyframeEvent, VreoUnit, VreoVideo } from '../typings/VreoUnit'
|
|
6
6
|
import { VideoAgentScene } from './modules/VideoAgent/VideoAgentScene'
|
|
7
|
-
import { PlayerConfigs } from './typings'
|
|
7
|
+
import { Appearance, PlayerConfigs, WaveAppearance } from './typings'
|
|
8
|
+
import setElementDataset from '../shared-utils/setElementDataset'
|
|
9
|
+
import { getMediaType } from '../shared-utils/getMediaInfo'
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* 逻辑控制器:内部状态。
|
|
11
13
|
*/
|
|
12
14
|
export class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
16
|
+
five: Five
|
|
17
|
+
configs: PlayerConfigs
|
|
18
|
+
videoAgentScene?: VideoAgentScene
|
|
19
|
+
vreoUnit?: VreoUnit
|
|
20
|
+
stopInterval?: () => void
|
|
21
|
+
playing = false
|
|
22
|
+
ended = false
|
|
23
|
+
loading: boolean | null = false // null 表示加载失败
|
|
24
|
+
containerSize?: {
|
|
25
|
+
width: number
|
|
26
|
+
height: number
|
|
27
|
+
}
|
|
28
|
+
appSize?: 'S' | 'M' | 'L' | 'XL'
|
|
29
|
+
container: Element
|
|
30
|
+
waveAppearance: WaveAppearance | null = null
|
|
31
|
+
appearance: Appearance = {
|
|
32
|
+
waveStyle: 'solid',
|
|
33
|
+
}
|
|
34
|
+
avatar?: VreoVideo['avatar']
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
visible = false
|
|
38
|
+
|
|
39
|
+
get agentType() {
|
|
40
|
+
const type = getMediaType(this.videoAgentScene?.videoAgentMesh.videoUrl)
|
|
41
|
+
if (this.avatar?.force) return 'avatar'
|
|
42
|
+
if (type === 'video') return 'video'
|
|
43
|
+
return 'none'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
popUp: string | JSX.Element | null = null
|
|
47
|
+
|
|
48
|
+
openPopUp(popUp: string | JSX.Element | false) {
|
|
49
|
+
if (!popUp) {
|
|
50
|
+
this.popUp = null
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
this.popUp = popUp
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setLoading(loading: boolean | null) {
|
|
57
|
+
this.loading = loading
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
drawerConfig: {
|
|
61
|
+
content: string | JSX.Element
|
|
62
|
+
height?: number | string
|
|
63
|
+
} | null = null
|
|
64
|
+
|
|
65
|
+
setAvatar(avatar: VreoVideo['avatar']) {
|
|
66
|
+
this.avatar = avatar
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setContainerSize(width: number, height: number) {
|
|
70
|
+
this.containerSize = { width, height }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setVisible(v: boolean) {
|
|
74
|
+
this.visible = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setPlaying(playing: boolean) {
|
|
78
|
+
this.playing = playing
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setEnded(ended: boolean) {
|
|
82
|
+
this.ended = ended
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setAppearance(appearance: Appearance) {
|
|
86
|
+
this.appearance = { ...this.appearance, ...appearance }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
openDrawer(drawerConfig?: false | { content: string | JSX.Element; height?: number | string }) {
|
|
90
|
+
if (!drawerConfig) {
|
|
91
|
+
this.drawerConfig = {
|
|
92
|
+
content: '',
|
|
93
|
+
height: this.drawerConfig?.height
|
|
94
|
+
}
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.drawerConfig = drawerConfig
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
constructor({five, container, configs}: { five: Five, container: Element, configs: PlayerConfigs }) {
|
|
102
|
+
super()
|
|
103
|
+
|
|
104
|
+
this.configs = configs
|
|
105
|
+
this.container = container
|
|
106
|
+
this.five = five
|
|
107
|
+
this.appSize = configs.appSize
|
|
108
|
+
this.appearance = { ...this.appearance, ...configs.appearance }
|
|
109
|
+
|
|
110
|
+
makeObservable(this, {
|
|
111
|
+
visible: observable,
|
|
112
|
+
setVisible: action,
|
|
113
|
+
playing: observable,
|
|
114
|
+
setPlaying: action,
|
|
115
|
+
loading: observable,
|
|
116
|
+
setLoading: action,
|
|
117
|
+
popUp: observable.ref,
|
|
118
|
+
openPopUp: action,
|
|
119
|
+
drawerConfig: observable.ref,
|
|
120
|
+
openDrawer: action,
|
|
121
|
+
ended: observable,
|
|
122
|
+
waveAppearance: observable,
|
|
123
|
+
avatar: observable,
|
|
124
|
+
containerSize: observable,
|
|
125
|
+
setContainerSize: action,
|
|
126
|
+
appearance: observable,
|
|
127
|
+
setAppearance: action,
|
|
128
|
+
configs: observable.ref,
|
|
129
|
+
setEnded: action,
|
|
130
|
+
setAvatar: action,
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
reaction<[typeof this.appearance.waveStyle, boolean | null], boolean>(
|
|
134
|
+
() => [this.appearance.waveStyle, this.loading],
|
|
135
|
+
([waveStyle, loading]) => {
|
|
136
|
+
if (loading === null) {
|
|
137
|
+
this.waveAppearance = null
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
if (waveStyle === 'wave') {
|
|
141
|
+
switch (loading) {
|
|
142
|
+
case true:
|
|
143
|
+
this.waveAppearance = 'double'
|
|
144
|
+
break
|
|
145
|
+
case false:
|
|
146
|
+
this.waveAppearance = 'solid'
|
|
147
|
+
break
|
|
148
|
+
}
|
|
149
|
+
} else if (waveStyle === 'solid') {
|
|
150
|
+
switch (loading) {
|
|
151
|
+
case true:
|
|
152
|
+
this.waveAppearance = 'swap'
|
|
153
|
+
break
|
|
154
|
+
case false:
|
|
155
|
+
this.waveAppearance = 'expand'
|
|
156
|
+
break
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{ fireImmediately: true }
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
if (!this.appSize) {
|
|
164
|
+
reaction(
|
|
165
|
+
() => this.containerSize,
|
|
166
|
+
(containerSize) => {
|
|
167
|
+
if (!containerSize) return
|
|
168
|
+
const width = containerSize.width
|
|
169
|
+
const height = containerSize.height
|
|
170
|
+
const size = (() => {
|
|
171
|
+
if (width <= 500) return 'S'
|
|
172
|
+
if (width <= 1024) return 'M'
|
|
173
|
+
if (width <= 2048) return 'L'
|
|
174
|
+
return 'XL'
|
|
175
|
+
})()
|
|
176
|
+
const orientation = (() => {
|
|
177
|
+
if (height > width) return 'portrait'
|
|
178
|
+
return 'landscape'
|
|
179
|
+
})()
|
|
180
|
+
setElementDataset(this.container, { size })
|
|
181
|
+
setElementDataset(this.container, { orientation })
|
|
182
|
+
},
|
|
183
|
+
{ fireImmediately: true }
|
|
184
|
+
)
|
|
185
|
+
} else {
|
|
186
|
+
setElementDataset(this.container, { size: this.appSize })
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// 监听播放情况:抛出触发时机
|
|
190
|
+
reaction(
|
|
191
|
+
() => this.ended,
|
|
192
|
+
(ended) => {
|
|
193
|
+
if (ended) {
|
|
194
|
+
this.emit('paused', true)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
reaction(
|
|
200
|
+
() => this.playing,
|
|
201
|
+
(playing) => {
|
|
202
|
+
if (!this.ended) {
|
|
203
|
+
this.emit(playing ? 'playing' : 'paused')
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
get ready() {
|
|
211
|
+
return !!this.videoAgentScene
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
get currentTime() {
|
|
215
|
+
return this.videoAgentScene?.videoAgentMesh.currentTime || 0
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
get currentKeyframes() {
|
|
219
|
+
if (!this.vreoUnit) return []
|
|
220
|
+
const keyframes = this.vreoUnit.keyframes
|
|
221
|
+
// 没有被解析过且开始时间低于当前时间戳 100ms
|
|
222
|
+
return keyframes.filter((keyframe: VreoKeyframe) => {
|
|
223
|
+
if (keyframe.parsed) return false
|
|
224
|
+
const dur = this.currentTime - keyframe.start
|
|
225
|
+
return dur <= 100 && dur >= 0
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
get mediaInstance() {
|
|
230
|
+
return this.videoAgentScene?.videoAgentMesh.mediaInstance
|
|
149
231
|
}
|
|
150
232
|
|
|
151
233
|
/**
|
|
152
|
-
*
|
|
234
|
+
* 逐帧任务
|
|
153
235
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
236
|
+
requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void) {
|
|
237
|
+
if (this.mediaInstance?.ended) {
|
|
238
|
+
this.setEnded(true)
|
|
239
|
+
this.setPlaying(false)
|
|
240
|
+
this.mediaInstance.pause()
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (!this.playing) {
|
|
245
|
+
if (!this.mediaInstance?.paused) {
|
|
246
|
+
this.mediaInstance?.pause()
|
|
247
|
+
}
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (this.mediaInstance?.paused && this.playing) {
|
|
252
|
+
this.mediaInstance.play()
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const currentKeyframes = this.currentKeyframes
|
|
256
|
+
|
|
257
|
+
currentKeyframes.forEach((keyframe) => {
|
|
258
|
+
if (keyframe.parsed) return
|
|
259
|
+
keyframe.parsed = true
|
|
260
|
+
this.emit(keyframe.type, keyframe)
|
|
261
|
+
if (callback) {
|
|
262
|
+
callback(keyframe.type, keyframe)
|
|
263
|
+
}
|
|
264
|
+
})
|
|
157
265
|
}
|
|
158
266
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
267
|
+
run(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void) {
|
|
268
|
+
if (this.stopInterval) return
|
|
269
|
+
this.stopInterval = requestAnimationFrameInterval(() => this.requestAnimationFrameLoop(callback))
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
dispose() {
|
|
273
|
+
this.setPlaying(false)
|
|
274
|
+
|
|
275
|
+
if (this.currentKeyframes) {
|
|
276
|
+
this.currentKeyframes.forEach((keyframe) => (keyframe.parsed = false))
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* 清理掉数据
|
|
281
|
+
*/
|
|
282
|
+
this.vreoUnit = undefined
|
|
283
|
+
if (this.mediaInstance) {
|
|
284
|
+
this.mediaInstance.currentTime = 0
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (this.stopInterval) {
|
|
288
|
+
this.stopInterval()
|
|
289
|
+
this.stopInterval = undefined
|
|
290
|
+
}
|
|
162
291
|
}
|
|
163
|
-
}
|
|
164
292
|
}
|
|
165
293
|
|
|
166
|
-
|
|
294
|
+
const ControllerContext = React.createContext<Controller | null>(null)
|
|
295
|
+
|
|
296
|
+
export { ControllerContext }
|
|
297
|
+
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import ReactDOM from 'react-dom'
|
|
3
3
|
import { Five } from '@realsee/five'
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { CSS3DRenderPlugin, CSS3DRenderPluginExportType } from '@realsee/dnalogel/plugins/CSS3DRenderPlugin'
|
|
4
|
+
import { Raycaster, Vector3 } from 'three'
|
|
5
|
+
import { tweenProgress } from '../../../shared-utils/animationFrame/BetterTween'
|
|
6
|
+
import { CSS3DRenderPlugin, CSS3DRenderPluginExportType } from '../../../fivePlugins/CSS3DRenderPlugin'
|
|
8
7
|
|
|
9
8
|
import { VreoKeyframe, VreoKeyframeEnum } from '../../../typings/VreoUnit'
|
|
10
9
|
import { CustomVreoKeyframeProps } from '../../typings'
|
|
@@ -33,6 +32,7 @@ import { CustomVreoKeyframeProps } from '../../typings'
|
|
|
33
32
|
// "temperature": "27",
|
|
34
33
|
// "title": "沉浸式回家"
|
|
35
34
|
// }
|
|
35
|
+
|
|
36
36
|
export interface SpatialScenePanelData {
|
|
37
37
|
customType: 'SpatialScenePanel'
|
|
38
38
|
title: string
|
|
@@ -222,7 +222,7 @@ const Panel = React.forwardRef(
|
|
|
222
222
|
<div className="SpatialScenePanel-body">
|
|
223
223
|
{props.data?.stateList?.map((state, index) => (
|
|
224
224
|
<div key={`scene-${state.text}`} className={`SpatialScenePanel-item index_${index}`}>
|
|
225
|
-
<img className="SpatialScenePanel-icon" src={state.icon}></img>
|
|
225
|
+
<img className="SpatialScenePanel-icon" src={state.icon} alt={`${state.text}`}></img>
|
|
226
226
|
<div className="SpatialScenePanel-text">{state.text}</div>
|
|
227
227
|
<div className="SpatialScenePanel-dot"></div>
|
|
228
228
|
</div>
|
|
@@ -2,8 +2,6 @@ import React from 'react'
|
|
|
2
2
|
import { Vector3 } from 'three'
|
|
3
3
|
import { ControllerContext } from './Controller'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
export function useController() {
|
|
8
6
|
const controller = React.useContext(ControllerContext)
|
|
9
7
|
if (!controller) {
|
|
@@ -15,14 +13,14 @@ export function useController() {
|
|
|
15
13
|
|
|
16
14
|
export function useFiveInstance() {
|
|
17
15
|
const controller = useController()
|
|
18
|
-
if (!controller
|
|
16
|
+
if (!controller.five) {
|
|
19
17
|
throw new Error('没有找到 "five" 实例')
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
return controller
|
|
20
|
+
return controller.five
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export function useFiveProject2d() {
|
|
26
24
|
const five = useFiveInstance()
|
|
27
25
|
return (vector: Vector3) => five.project2d(vector, false)
|
|
28
|
-
}
|
|
26
|
+
}
|