@@ -41,6 +41,29 @@ const styles = theme => ({
41
41
animationIterationCount : "1" ,
42
42
animationDelay : "750ms" ,
43
43
} ,
44
+ "@keyframes glitched" : {
45
+ "0%" : { opacity : "1" } ,
46
+ "60%" : { opacity : "1" } ,
47
+ "64%" : { opacity : "0.72" } ,
48
+ "68%" : { opacity : "0.94" } ,
49
+ "72%" : { opacity : "1" } ,
50
+ "76%" : { opacity : "0.82" } ,
51
+ "80%" : { opacity : "1" } ,
52
+ "84%" : { opacity : "0.92" } ,
53
+ "88%" : { opacity : "0.84" } ,
54
+ "92%" : { opacity : "1" } ,
55
+ "96%" : { opacity : "0.90" } ,
56
+ "100%" : { opacity : "1" } ,
57
+ } ,
58
+ glitch : {
59
+ animationFillMode : "both" ,
60
+ animationName : "$glitched" ,
61
+ animationDuration : "1250ms" ,
62
+ animationTimingFunction : "linear" ,
63
+ animationDirection : "alternate" ,
64
+ animationIterationCount : "infinite" ,
65
+ animationDelay : "0ms" ,
66
+ } ,
44
67
restrictedSVG : {
45
68
animationFillMode : "both" ,
46
69
animationName : "$glitchmenu" ,
@@ -69,7 +92,13 @@ class NavigateOmniperium extends React.PureComponent {
69
92
classes : props . classes ,
70
93
hover : "welcome" ,
71
94
video : { pause : function ( ) { } } ,
72
- open : props . open
95
+ open : props . open ,
96
+ _menu_pos : { } ,
97
+ _menu_ref : { } ,
98
+ _root_ref : { } ,
99
+ _transform_rotate : "" ,
100
+ _background_image : "" ,
101
+ _filter : ""
73
102
} ;
74
103
} ;
75
104
@@ -101,7 +130,9 @@ class NavigateOmniperium extends React.PureComponent {
101
130
//this.st4te.video.pause();
102
131
this . setSt4te ( { hover : path } , ( ) => {
103
132
this . forceUpdate ( ( ) => {
104
- document . getElementById ( "explanation-video" ) . play ( ) ;
133
+ try {
134
+ document . getElementById ( "explanation-video" ) . play ( ) ;
135
+ } catch ( e ) { }
105
136
} ) ;
106
137
} ) ;
107
138
}
@@ -147,12 +178,93 @@ class NavigateOmniperium extends React.PureComponent {
147
178
} catch ( e ) { }
148
179
} ;
149
180
181
+ setWrapperRef = ( element ) => {
182
+
183
+ if ( typeof element === "undefined" ) { return }
184
+ if ( element === null ) { return }
185
+ this . setSt4te ( { _root_ref : element } , ( ) => {
186
+ this . st4te . _root_ref . addEventListener ( "pointermove" , this . computeRotation ) ;
187
+ } ) ;
188
+
189
+ }
190
+
191
+ setMenuRef = ( element ) => {
192
+
193
+ if ( typeof element === "undefined" ) { return }
194
+ if ( element === null ) { return }
195
+ console . log ( element )
196
+ const rect = element . getBoundingClientRect ( ) ;
197
+ this . setSt4te ( { _menu_ref : element , _menu_pos : rect } ) ;
198
+
199
+ }
200
+
201
+ computeRotation = ( event ) => {
202
+ "use strict" ;
203
+ console . log ( event )
204
+ const pageX = parseInt ( event . pageX ) ;
205
+ const pageY = parseInt ( event . pageY ) ;
206
+ const rect = this . st4te . _menu_pos ;
207
+ console . log ( rect )
208
+ const perspective = 1 ;
209
+ const currentScale = 1.0 ;
210
+ const pos_x_in_canvas_container = pageX - rect . left | 0 ;
211
+ const pos_y_in_canvas_container = pageY - rect . top | 0 ;
212
+
213
+ const x = perspective * ( pos_x_in_canvas_container - rect . width / 2 ) / ( rect . width / 2 ) ;
214
+ const y = - perspective * ( pos_y_in_canvas_container - rect . height / 2 ) / ( rect . height / 2 ) ;
215
+ const p_x = x > perspective ? x : x * 2 ;
216
+ const p_y = y < 0 ? y : 2 * y ;
217
+ const p_x_things = 255 - p_x / 2 * 255 ;
218
+ const p_y_things = p_y / 2 * 255 ;
219
+
220
+ const rotate_y = ( p_x * 1.25 / currentScale * 1000 | 0 ) / 1000 ;
221
+ const rotate_x = ( p_y * 1.25 / currentScale * 1000 | 0 ) / 1000 ;
222
+ const any_rotation = Boolean ( rotate_x || rotate_y ) ;
223
+
224
+ const transform_rotate = any_rotation ? `rotateX(${ rotate_x } deg) rotateY(${ rotate_y } deg)` : ``
225
+ const background_image = any_rotation ? `linear-gradient(to right, rgba(
226
+ ${ p_x_things . toFixed ( 3 ) } ,
227
+ ${ p_x_things . toFixed ( 3 ) } ,
228
+ ${ p_x_things . toFixed ( 3 ) } ,
229
+ ${ ( Math . abs ( p_x * 0.1 ) / ( perspective * 2 ) ) . toFixed ( 2 ) }
230
+ ), rgba(
231
+ ${ p_x_things . toFixed ( 3 ) } ,
232
+ ${ p_x_things . toFixed ( 3 ) } ,
233
+ ${ p_x_things . toFixed ( 3 ) } ,
234
+ ${ ( Math . abs ( p_x * 0.6 ) / ( perspective * 2 ) ) . toFixed ( 2 ) }
235
+ )), linear-gradient(to top, rgba(
236
+ ${ p_y_things . toFixed ( 3 ) } ,
237
+ ${ p_y_things . toFixed ( 3 ) } ,
238
+ ${ p_y_things . toFixed ( 3 ) } ,
239
+ ${ ( Math . abs ( p_y * 0.75 ) / ( perspective * 2 ) ) . toFixed ( 2 ) }
240
+ ), rgba(
241
+ ${ p_y_things . toFixed ( 3 ) } ,
242
+ ${ p_y_things . toFixed ( 3 ) } ,
243
+ ${ p_y_things . toFixed ( 3 ) } ,
244
+ ${ ( Math . abs ( p_y * 0.25 ) / ( perspective * 2 ) ) . toFixed ( 2 ) }
245
+ ))` : `` ;
246
+ const filter_force = ( 1 + ( - rotate_y + rotate_x ) / 80 ) . toFixed ( 2 ) ;
247
+ const filter = any_rotation ? `brightness(${ filter_force } ) contrast(${ filter_force } )` : "" ;
248
+
249
+ console . log ( transform_rotate )
250
+ this . setSt4te ( {
251
+ _transform_rotate : transform_rotate ,
252
+ _background_image : background_image ,
253
+ _filter : filter
254
+ } , ( ) => {
255
+ this . forceUpdate ( ) ;
256
+ } ) ;
257
+ }
258
+
150
259
render ( ) {
151
260
152
261
const {
153
262
classes,
154
263
open,
155
- hover
264
+ hover,
265
+ _transform_rotate,
266
+ _background_image,
267
+ _filter
156
268
} = this . st4te ;
157
269
158
270
return (
@@ -162,24 +274,32 @@ class NavigateOmniperium extends React.PureComponent {
162
274
maxWidth = { "xl" }
163
275
onClose = { this . props . onClose }
164
276
disablePortal = { true }
165
- keepMounted = { true } >
166
- < OmniperiumMenu onHoverPathChange = { ( path ) => { this . omniperium_hover ( path ) } } onPathChange = { ( path ) => { this . omniperium_naviguate ( path ) } } className = { classes . activateSVG } style = { { height : "min(75vh, 75vw)" , width : "min(75vh, 75vw)" , margin : "auto" } } />
277
+ keepMounted = { true }
278
+ ref = { this . setWrapperRef } >
279
+ < div style = { { perspective : 200 } } ref = { this . setMenuRef } className = { classes . glitch } >
280
+ < OmniperiumMenu onHoverPathChange = { ( path ) => { this . omniperium_hover ( path ) } } onPathChange = { ( path ) => { this . omniperium_naviguate ( path ) } } className = { classes . activateSVG } style = { { height : "min(75vh, 75vw)" , width : "min(75vh, 75vw)" , margin : "auto" , transform : _transform_rotate , filter : _filter } } />
281
+ </ div >
167
282
</ Dialog >
168
- < img src = "/src/videos/omniperium/poster.png" width = "720" height = "720" style = { { display : open ? "inherit" : "none" , pointerEvents : "none" , zIndex : "1400" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "lighten" } } />
169
- < img src = "/src/videos/omniperium/poster.png" width = "720" height = "720" style = { { display : open ? "inherit" : "none" , pointerEvents : "none" , zIndex : "1401" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "multiply" } } />
170
- < video width = "720" height = "720" style = { { display : open ? "inherit" : "none" , pointerEvents : "none" , zIndex : "1500" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "lighten" } } key = { hover } autoPlay = { open } id = "explanation-video" >
171
- < source src = { "/src/videos/omniperium/" + hover + ".mp4" } type = "video/mp4" />
172
- </ video >
173
- < video width = "1920" height = "1080" style = { { display : open ? "inherit" : "none" , zIndex : "1401" , pointerEvents : "none" , minWidth : "100vw" , aspectRatio : "16 / 9" , position : "fixed" , left : "0" , bottom : "0" , mixBlendMode : "lighten" } } id = "particles-video" loop = { false } >
174
- < source src = "/src/videos/omnintro.mp4" type = "video/mp4" />
175
- </ video >
176
- < video width = "1920" height = "1080" style = { { display : open ? "inherit" : "none" , zIndex : "1400" , pointerEvents : "none" , minWidth : "100vw" , aspectRatio : "16 / 9" , position : "fixed" , left : "0" , bottom : "0" , mixBlendMode : "lighten" } } id = "particles-background-video" key = { open } autoPlay = { open } loop = { open } >
177
- < source src = "/src/videos/particles.mp4" type = "video/mp4" />
178
- </ video >
179
- < img src = "/src/images/omniperium/caution.svg" className = { classes . restrictedSVG } style = { { display : open ? "inherit" : "none" , pointerEvents : "none" , zIndex : "1501" , cursor : "pointer" , aspectRatio : "340 / 23" , width : "95vw" , position : "fixed" , left : "2.5vw" , bottom : "5vh" } } />
180
- < IconButton style = { { position : "absolute" , top : 16 , right : 16 , color : "white" , zIndex : "1402" , } } onClick = { ( ) => { this . omniperium_hover ( "explanation" ) } } >
181
- < InfoIcon style = { { color : "currentColor" } } />
182
- </ IconButton >
283
+ {
284
+ open &&
285
+ < React . Fragment >
286
+ < img src = "/src/videos/omniperium/poster.png" width = "720" height = "720" style = { { display : open ? "inherit" : "none" , userSelect : "none" , pointerEvents : "none" , zIndex : "1400" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "inherit" } } />
287
+ < img src = "/src/videos/omniperium/poster.png" width = "720" height = "720" style = { { display : open ? "inherit" : "none" , userSelect : "none" , pointerEvents : "none" , zIndex : "1401" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "saturation" } } />
288
+ < video width = "720" height = "720" style = { { display : open ? "inherit" : "none" , pointerEvents : "none" , userSelect : "none" , zIndex : "1500" , cursor : "pointer" , aspectRatio : "1 / 1" , width : "min(360px, 30vh)" , height : "min(360px, 30vh)" , position : "fixed" , left : "0%" , bottom : "0%" , mixBlendMode : "lighten" } } key = { hover } autoPlay = { open } id = "explanation-video" >
289
+ < source src = { "/src/videos/omniperium/" + hover + ".mp4" } type = "video/mp4" />
290
+ </ video >
291
+ < video width = "1920" height = "1080" style = { { display : open ? "inherit" : "none" , zIndex : "1401" , userSelect : "none" , pointerEvents : "none" , minWidth : "100vw" , aspectRatio : "16 / 9" , position : "fixed" , left : "0" , bottom : "0" , mixBlendMode : "lighten" } } id = "particles-video" loop = { false } >
292
+ < source src = "/src/videos/particles3.mp4" type = "video/mp4" />
293
+ </ video >
294
+ < video width = "1920" height = "1080" style = { { display : open ? "inherit" : "none" , zIndex : "1250" , userSelect : "none" , pointerEvents : "none" , minWidth : "100vw" , aspectRatio : "16 / 9" , position : "fixed" , left : "0" , bottom : "0" , mixBlendMode : "lighten" } } id = "particles-background-video" key = { open } autoPlay = { open } loop = { open } >
295
+ < source src = "/src/videos/particles.mp4" type = "video/mp4" />
296
+ </ video >
297
+ < img src = "/src/images/omniperium/caution.svg" className = { classes . restrictedSVG } style = { { display : open ? "inherit" : "none" , userSelect : "none" , pointerEvents : "none" , zIndex : "1501" , cursor : "pointer" , aspectRatio : "340 / 23" , width : "95vw" , position : "fixed" , left : "2.5vw" , bottom : "5vh" } } />
298
+ < IconButton style = { { position : "fixed" , left : 16 , right : 16 , color : "white" , zIndex : "1402" , } } onClick = { ( ) => { this . omniperium_hover ( "explanation" ) } } >
299
+ < InfoIcon style = { { color : "currentColor" } } />
300
+ </ IconButton >
301
+ </ React . Fragment >
302
+ }
183
303
</ React . Fragment >
184
304
) ;
185
305
}
0 commit comments