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