@realsee/vreo 0.2.0-alpha.6 → 0.2.0-alpha.7

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 (33) hide show
  1. package/docs/classes/Player.Controller.html +3 -3
  2. package/docs/classes/Player.Player-1.html +3 -3
  3. package/docs/classes/Player.VideoAgentMesh.html +11 -11
  4. package/docs/classes/Player.VideoAgentScene.html +1 -1
  5. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  6. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  7. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  8. package/docs/enums/Player.PanoTagEnum.html +1 -1
  9. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  10. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  11. package/docs/enums/fivePlugins.Rotation.html +1 -1
  12. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  13. package/docs/interfaces/Player.PlayerConfigs.html +2 -2
  14. package/docs/interfaces/Player.Vertex.html +1 -1
  15. package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -1
  16. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  17. package/docs/interfaces/Player.VreoUnit.html +1 -1
  18. package/docs/interfaces/Player.VreoVideo.html +1 -1
  19. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  20. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  21. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  22. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  23. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  24. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  25. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  26. package/docs/modules/Player.html +13 -13
  27. package/docs/modules/custom.html +1 -1
  28. package/docs/modules/fivePlugins.html +2 -2
  29. package/docs/modules/react.html +1 -1
  30. package/lib/Player/custom/SpatialScenePanel/index.js +87 -14
  31. package/package.json +2 -2
  32. package/resources/Player/custom/SpatialScenePanel/index.tsx +85 -8
  33. package/stylesheets/custom/SpatialScenePanel.css +14 -8
@@ -1,13 +1,15 @@
1
1
  import * as React from 'react'
2
2
  import ReactDOM from 'react-dom'
3
3
  import { Five } from '@realsee/five'
4
- import { Raycaster, Vector3 } from 'three'
4
+ import * as THREE from 'three'
5
+ import { Object3D, Raycaster, Vector3 } from 'three'
5
6
  import { tweenProgress } from '@realsee/dnalogel/shared-utils/animationFrame/BetterTween'
6
7
  import { CSS3DRenderPlugin, CSS3DRenderPluginExportType } from '@realsee/dnalogel/plugins/CSS3DRenderPlugin'
7
8
 
8
9
  import { VreoKeyframe, VreoKeyframeEnum } from '../../../typings/VreoUnit'
9
10
  import { CustomVreoKeyframeProps } from '../../typings'
10
11
 
12
+ // __debug__
11
13
  // const mockData: SpatialScenePanelData = {
12
14
  // customType: 'SpatialScenePanel',
13
15
  // "stateList": [
@@ -66,6 +68,7 @@ const searchV1 = ({ five, dom }: SearchParams) => {
66
68
  const [intersect] = five.model.intersectRaycaster(new Raycaster(cameraPosition, cameraDirection))
67
69
  const point = five.project2d(intersect.point)
68
70
 
71
+ const widescreen = window.innerWidth > 560 ? true : false
69
72
  // const width = dom!.clientWidth
70
73
  const height = dom!.clientHeight
71
74
  dom!.style.left = point!.x + 'px'
@@ -79,8 +82,8 @@ const searchV1 = ({ five, dom }: SearchParams) => {
79
82
  const rightBottom = new Vector3(right, bottom)
80
83
 
81
84
  const points = [leftBottom, rightBottom, rightTop, leftTop].map((point) => {
82
- point.setX((point.x / window.innerWidth) * 2 - 1.25)
83
- point.setY(-(point.y / window.innerHeight) * 2 + 1)
85
+ point.setX((point.x / window.innerWidth) * 2 - (widescreen ? 1.25: 1.75))
86
+ point.setY(-(point.y / window.innerHeight) * 2 + (widescreen ? 1.35: 1.125))
84
87
  point.setZ(0.5)
85
88
  return point.unproject(five.camera).addScaledVector(cameraDirection, 0.2)
86
89
  })
@@ -89,7 +92,8 @@ const searchV1 = ({ five, dom }: SearchParams) => {
89
92
  // const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
90
93
  // points.forEach((p, index) => five.scene.add(getSphere(p, colors[index])))
91
94
 
92
- const ratio = leftBottom.distanceTo(rightBottom) / 150
95
+ // 判断是手机 150
96
+ const ratio = leftBottom.distanceTo(rightBottom) / (widescreen ? 150 : 120)
93
97
  return { points, ratio }
94
98
  }
95
99
 
@@ -98,6 +102,7 @@ const searchV1 = ({ five, dom }: SearchParams) => {
98
102
  * @returns
99
103
  */
100
104
  export function SpatialScenePanel(props: CustomVreoKeyframeProps) {
105
+ const timeoutRef = React.useRef<NodeJS.Timeout | null>(null)
101
106
  const ref = React.useRef<HTMLDivElement>(null)
102
107
  const panelRef = React.useRef<HTMLDivElement | null>(null)
103
108
  const rendererRef = React.useRef<CSS3DRenderPluginExportType>(CSS3DRenderPlugin(props.five))
@@ -123,16 +128,19 @@ export function SpatialScenePanel(props: CustomVreoKeyframeProps) {
123
128
  const { container, dispose, css3DObject, render } =
124
129
  rendererRef.current.create3DDomContainer(points, { ratio, autoRender: false }) || {}
125
130
 
131
+ Object.assign(window, { $css3DObject: css3DObject })
126
132
  if (!container) return
127
133
 
128
134
  ReactDOM.render(<Panel ref={(ref) => (panelRef.current = ref)} data={data} />, container)
129
135
  const startRotateY = -(Math.PI * 2) / 9
130
136
  let lastRotateY = 0
137
+
131
138
  tweenProgress(1000)
132
139
  .onUpdate(({ progress }) => {
133
140
  const needRotateY = (Math.PI / 90) * 11 * progress
134
141
  const rotateY = needRotateY - lastRotateY
135
142
  css3DObject?.rotateY(rotateY)
143
+ // css3DObject?.rotateZ
136
144
  lastRotateY = needRotateY
137
145
  })
138
146
  .onStart(() => {
@@ -143,30 +151,71 @@ export function SpatialScenePanel(props: CustomVreoKeyframeProps) {
143
151
  panelRef.current?.classList.add('show')
144
152
  })
145
153
  .play()
154
+
155
+ // Object.assign(window, { $dispose: () => {
156
+ // panelRef.current?.classList.add('hide')
157
+ // setTimeout(() => dispose?.(), 1500)
158
+ // } })
159
+
146
160
  const { start, end } = keyframe
147
161
 
148
- setTimeout(() => {
162
+ timeoutRef.current = setTimeout(() => {
149
163
  panelRef.current?.classList.add('hide')
150
- setTimeout(() => dispose?.(), 1500)
164
+ timeoutRef.current = setTimeout(() => {
165
+ dispose?.()
166
+ timeoutRef.current = null
167
+ }, 1500)
151
168
  }, end - start)
152
169
  }
153
170
 
154
- // Object.assign(window, { $callback: callback })
171
+ Object.assign(window, { $callback: callback })
172
+
173
+ // setTimeout(() => {callback()}, 8000)
155
174
  props.subscribe.on(VreoKeyframeEnum.Custom, callback)
156
175
 
157
176
  return () => {
158
177
  props.subscribe.off(VreoKeyframeEnum.Custom, callback)
178
+ if (timeoutRef.current) {
179
+ clearTimeout(timeoutRef.current)
180
+ }
159
181
  }
160
182
  }, [])
161
183
 
162
184
  return <div className="vreo-SpatialScenePanel" ref={ref}></div>
163
185
  }
164
186
 
187
+ /** 背景动画:控制延迟 */
188
+ function SpatialScenePanelBg() {
189
+ const ref = React.useRef<HTMLDivElement>(null)
190
+ const timeoutRef = React.useRef<NodeJS.Timeout | null>(null)
191
+ React.useEffect(() => {
192
+ if (!ref.current) return
193
+
194
+ const listener = () => {
195
+ console.log('listener')
196
+ ref.current?.setAttribute('class', 'SpatialScenePanel-bg')
197
+
198
+ timeoutRef.current = setTimeout(() => {
199
+ ref.current?.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation')
200
+ timeoutRef.current = null
201
+ }, 3000)
202
+ }
203
+
204
+ ref.current.addEventListener('animationend', listener)
205
+
206
+ return () => {
207
+ if (ref.current) ref.current.removeEventListener('animationend', listener)
208
+ if (timeoutRef.current) clearTimeout(timeoutRef.current)
209
+ }
210
+ }, [])
211
+ return <div ref={ref} className="SpatialScenePanel-bg SpatialScenePanel-bg--animation"></div>
212
+ }
213
+
165
214
  const Panel = React.forwardRef(
166
215
  (props: { data: SpatialScenePanelData }, myRef: React.LegacyRef<HTMLDivElement> | undefined) => (
167
216
  <div className="SpatialScenePanel" ref={myRef}>
168
217
  <div className="SpatialScenePanel-show-area">
169
- <div className="SpatialScenePanel-bg"></div>
218
+ <SpatialScenePanelBg />
170
219
  <div className="SpatialScenePanel-header">
171
220
  <div className="SpatialScenePanel-title">{props.data?.title}</div>
172
221
  <div className="SpatialScenePanel-temperature">{props.data?.temperature}℃</div>
@@ -186,3 +235,31 @@ const Panel = React.forwardRef(
186
235
  </div>
187
236
  )
188
237
  )
238
+
239
+
240
+ // export function SpatialScenePanel() {
241
+ // // const data = mockData
242
+
243
+ // return (
244
+ // <div className="SpatialScenePanel" >
245
+ // <div className="SpatialScenePanel-show-area">
246
+ // <SpatialScenePanelBg />
247
+ // <div className="SpatialScenePanel-header">
248
+ // <div className="SpatialScenePanel-title">{data?.title}</div>
249
+ // <div className="SpatialScenePanel-temperature">{data?.temperature}℃</div>
250
+ // </div>
251
+ // <div className="SpatialScenePanel-body">
252
+ // {data?.stateList?.map((state, index) => (
253
+ // <div key={`scene-${state.text}`} className={`SpatialScenePanel-item index_${index}`}>
254
+ // <img className="SpatialScenePanel-icon" src={state.icon}></img>
255
+ // <div className="SpatialScenePanel-text">{state.text}</div>
256
+ // <div className="SpatialScenePanel-dot"></div>
257
+ // </div>
258
+ // ))}
259
+ // </div>
260
+ // </div>
261
+
262
+ // <div className="SpatialScenePanel-disappear-area"></div>
263
+ // </div>
264
+ // )
265
+ // }
@@ -77,9 +77,15 @@
77
77
  background-image: url("//vrlab-static.ljcdn.com/release/web/VoiceAssistant/images/panel-min.7d9ba2b7.png");
78
78
  background-size: 340rem 13.4375rem;
79
79
  background-repeat: no-repeat;
80
- animation: SpatialScenePanel-panel-sprites-animation 1.375s 0s steps(33) infinite normal
80
+ z-index: -1;
81
81
  }
82
82
 
83
+ .SpatialScenePanel-bg--animation {
84
+ /* animation: SpatialScenePanel-panel-sprites-animation 1.375s 0s steps(33) infinite normal; */
85
+ animation: SpatialScenePanel-panel-sprites-animation 1.375s 0.5s steps(33) normal;
86
+ }
87
+
88
+
83
89
  .SpatialScenePanel-show-area .SpatialScenePanel-header {
84
90
  width: 7.5rem;
85
91
  height: 1.375rem;
@@ -89,7 +95,9 @@
89
95
  background-image: url("//vrlab-static.ljcdn.com/release/web/VoiceAssistant/images/title-bg.377af865.png");
90
96
  background-size: 100%;
91
97
  margin: 1.875rem auto 1.25rem auto;
92
- padding-bottom: .25rem
98
+ background-image: linear-gradient(to left, rgba(234, 208, 154, 0), rgb(255 229 176 / 21%) 47%, rgba(234, 208, 154, 0));
99
+ border-bottom: 1px solid rgb(255 255 255 / 10%);
100
+ border-radius: 2px;
93
101
  }
94
102
 
95
103
  .SpatialScenePanel-show-area .SpatialScenePanel-header .SpatialScenePanel-title {
@@ -97,7 +105,7 @@
97
105
  font-size: 1.0625rem;
98
106
  color: #ffe5b0;
99
107
  letter-spacing: 0;
100
- line-height: 1.0625rem;
108
+ line-height: 1.125;
101
109
  text-shadow: 0 0 1.25rem rgba(0,0,0,0.15)
102
110
  }
103
111
 
@@ -106,7 +114,7 @@
106
114
  font-size: .625rem;
107
115
  color: rgba(255,229,176,0.6);
108
116
  letter-spacing: 0;
109
- line-height: .625rem;
117
+ line-height: 1.25rem;
110
118
  text-shadow: 0 0 .625rem rgba(255,255,255,0.03);
111
119
  align-self: flex-end
112
120
  }
@@ -270,9 +278,7 @@
270
278
 
271
279
  .SpatialScenePanel.hide .SpatialScenePanel-show-area {
272
280
  transform: scale3d(0,1,1);
273
- transition: -webkit-transform 500ms linear;
274
- transition: transform 500ms linear;
275
- transition: transform 500ms linear, -webkit-transform 500ms linear
281
+ transition: transform 150ms linear;
276
282
  }
277
283
 
278
284
  .SpatialScenePanel.hide .SpatialScenePanel-disappear-area {
@@ -298,6 +304,6 @@
298
304
  background-image: url("//vrlab-static.ljcdn.com/release/web/VoiceAssistant/images/line.4ac1c0bb.png");
299
305
  background-size: 10rem 11.666666666666666rem;
300
306
  background-repeat: no-repeat;
301
- animation: SpatialScenePanel-line-sprites-animation 500ms 500ms steps(23) 1 normal
307
+ animation: SpatialScenePanel-line-sprites-animation 500ms 100ms steps(23) 1 normal
302
308
  }
303
309