Commit 02bf6f01 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Change spaceship moving animation at correct times during transition animation

parent 01829ee6
...@@ -46,7 +46,10 @@ warp = -> ...@@ -46,7 +46,10 @@ warp = ->
# first stretch stars to create accelerating feel # first stretch stars to create accelerating feel
Velocity star_tails, Velocity star_tails,
{width: '500px'}, {width: '500px'},
{duration: 1000, easing: 'ease-in'} {
duration: 1000, easing: 'ease-in',
complete: -> document.body.className = 'excited'
}
# then shift # then shift
for tail in star_tails for tail in star_tails
...@@ -65,18 +68,21 @@ unwarp = -> ...@@ -65,18 +68,21 @@ unwarp = ->
for tail, i in star_tails for tail, i in star_tails
Velocity tail, Velocity tail,
{width: star_heights[i]}, {width: star_heights[i]},
{duration: 1000, easing: 'ease-in'} {
duration: 1000, easing: 'ease-in',
complete: -> document.body.className = 'cruising'
}
transitions = transitions =
cruising_excited: [warp] cruising_excited: warp
excited_cruising: [unwarp] excited_cruising: unwarp
set_state = (newstate) -> set_state = (newstate) ->
oldstate = document.body.className oldstate = document.body.className
if oldstate != newstate if oldstate != newstate
console.log 'set state from', oldstate, 'to', newstate console.log 'set state from', oldstate, 'to', newstate
f() for f in transitions[oldstate + '_' + newstate] ? [] transitions[oldstate + '_' + newstate]?()
document.body.className = newstate #document.body.className = newstate
if debug if debug
document.addEventListener 'keypress', (e) -> document.addEventListener 'keypress', (e) ->
......
...@@ -86,13 +86,11 @@ img, div { ...@@ -86,13 +86,11 @@ img, div {
/* Cruising state */ /* Cruising state */
.cruising { .cruising .spaceship {
.spaceship { animation: cruising-movement @cruising-move-duration linear 0s infinite;
animation: cruising-movement @cruising-move-duration linear 0s infinite;
img { img {
animation: cruising-rotation @cruising-tilt-duration linear 0s infinite alternate; animation: cruising-rotation @cruising-tilt-duration linear 0s infinite alternate;
}
} }
} }
...@@ -108,20 +106,12 @@ img, div { ...@@ -108,20 +106,12 @@ img, div {
/* Excited state */ /* Excited state */
.excited { .excited .spaceship {
.spaceship { animation: excited-movement @excited-move-duration linear 0s infinite;
animation: excited-movement @excited-move-duration linear 0s infinite;
img {
animation: excited-rotation @excited-tilt-duration linear 0s infinite alternate;
}
}
/* img {
.bg { animation: excited-rotation @excited-tilt-duration linear 0s infinite alternate;
animation: excited-bg-tilt 3s linear 0s infinite alternate;
} }
*/
} }
@keyframes excited-movement { @keyframes excited-movement {
...@@ -133,8 +123,3 @@ img, div { ...@@ -133,8 +123,3 @@ img, div {
from { transform: rotateZ(-@excited-nose-tilt / 2) } from { transform: rotateZ(-@excited-nose-tilt / 2) }
to { transform: rotateZ(@excited-nose-tilt / 2) } to { transform: rotateZ(@excited-nose-tilt / 2) }
} }
@keyframes excited-bg-tilt {
from { transform: rotateZ(0) }
to { transform: rotateZ(70deg) }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment