Commit 406970d7 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Give stars random distance and animate basd on distance

parent e585d015
......@@ -21,6 +21,7 @@ stars = for _ in [1..numstars]
size = rand min_star_size, max_star_size
red = green = rand 180, 255
star = document.createElement 'div'
star.distance = rand 10, 100
star.style.right = x + '%'
star.style.top = y + '%'
star.style.width = size + 'px'
......@@ -40,17 +41,17 @@ star_heights = (star.style.height for star in stars)
warp = ->
# first stretch stars to create accelerating feel
Velocity stars,
{width: '500px'},
{
duration: 1000, easing: 'ease-in',
complete: -> document.body.className = 'excited'
}
for star in stars
Velocity star,
{width: "#{star.distance * 0.35}%"},
{
duration: 1000, easing: 'ease-in',
complete: -> document.body.className = 'excited'
}
# then shift
for star in stars
amt = rand 0, 20
Velocity star, {right: "+=#{amt}%"}, {duration: 400}
Velocity star, {marginRight: "#{star.distance * 0.7}%"}, {duration: 400}
Velocity star, 'reverse', {duration: 1000}
# while stars shift, the spaceship goes back a little bit, then launches
......
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