forked from markNZed/processism-react-three
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneOne.js
More file actions
127 lines (112 loc) · 4.78 KB
/
Copy pathSceneOne.js
File metadata and controls
127 lines (112 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
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
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
import React from 'react';
import Scene from './Scene';
import { Camera, DynamicDoubleArrow, EmergentEntity, TargetText } from '../animationComponents';
import * as THREE from 'three';
import { AnimationController } from '../AnimationController'; // Adjust import path as necessary
import useStore from '../useStore'; // Adjust import path as necessary
import { Environment, OrbitControls } from '@react-three/drei';
function SceneOne() {
const emergentEntityRadius = 3.5;
// Delay, animationComponent id, animationState
const animationSequence = [
[0, 'inter_emergent', { visible: false }],
[0, 'emergent1', { variant: "oneSphere" }],
[0, 'emergent1.Circle', { variant: "hidden" }],
[0, 'emergent2', { visible: false }],
[0, 'emergent2.Circle', { variant: "hidden" }],
[0, 'emergent2.causation', { visible: false }],
[1, 'emergent1', { variant: "oneSphere-details", }],
[1, 'entityLabel', { variant: "fadeIn", }],
[1, 'entityLabel', { variant: "fadeOut", }],
[1, 'emergent1', { variant: "twoSphere", why: "Showing second sphere" }],
[1, 'emergent1', { variant: "relation" }],
[1, 'emergent1', { variant: "allRelations" }],
[1, 'accumulationDescription', { variant: "fadeIn" }],
[1, 'accumulationDescription', { variant: "fadeOut" }],
[1, 'emergent1.Circle', { duration: 1, variant: "visible", opacity: 0.5, visible: true }],
[1, 'emergent1Label', { duration: 1, variant: "fadeIn" }],
[1, 'emergent1Label', { duration: 1, variant: "fadeOut" }],
[1, 'emergent2', { visible: true, variant: "allRelations" }],
[1, 'emergent2.Circle', { duration: 1, variant: "visible", opacity: 0.5, visible: true }],
[2, 'camera', { position: [0, -30, 10], duration: 2000 }],
[2, 'emergent1Label', { text: 'Bottom Up', variant: "fadeIn" }],
[1, 'emergent1.causation', { visible: true }],
[0.5, 'inter_emergent', { visible: true }],
[2, 'emergent2Label', { text: 'Top Down', variant: "fadeIn" }],
[1, 'emergent2.causation', { visible: true }],
[1, 'emergent1', { variant: "moved", offset: new THREE.Vector3(5, 5, 5) }],
];
const cameraInitialState = {
position: [0, 0, 35],
zoom: 35,
left: window.innerWidth / -2,
right: window.innerWidth / 2,
top: window.innerHeight / 2,
bottom: window.innerHeight / -2,
near: 0.1,
far: 100
};
return (
<>
<AnimationController animations={animationSequence} useStore={useStore}>
<Scene>
<EmergentEntity
id="emergent1"
initialState={{
position: new THREE.Vector3(-emergentEntityRadius * 2, 0, 0),
radius: emergentEntityRadius,
causation: "bottomup",
}}
/>
<EmergentEntity
id="emergent2"
initialState={{
position: new THREE.Vector3(emergentEntityRadius * 2, 0, 0),
radius: emergentEntityRadius,
causation: "topdown",
}}
/>
<DynamicDoubleArrow
id={"inter_emergent"}
initialState={{
fromId: "emergent1",
toId: "emergent2",
visible: false,
}}
/>
<TargetText
id={'entityLabel'}
targetId={'emergent1.Sphere1'}
initialState={{ text: "Entity 1", variant: 'hidden', scale: .5 }}
offset={new THREE.Vector3(0, 1.5, 0)}
/>
<TargetText
id={'emergent1Label'}
targetId={'emergent1'}
initialState={{ text: "Emergent Entity", variant: 'hidden' }}
offset={new THREE.Vector3(0, 5, 0)}
/>
<TargetText
id={'emergent2Label'}
targetId={'emergent2'}
initialState={{ text: "Emergent Entity", variant: 'hidden' }}
offset={new THREE.Vector3(0, 5, 0)}
/>
<TargetText
id={'accumulationDescription'}
targetId={'emergent1.relations1'}
initialState={{ text: "Accumulation", variant: 'hidden', scale: .3 }}
offset={new THREE.Vector3(0, 3, -1.5)}
/>
</Scene>
</AnimationController>
<Camera
id={"camera"}
initialState={cameraInitialState}
/>
<Environment preset="sunset" />
<OrbitControls />
</>
);
}
export default SceneOne;