Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tothemoon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
tothemoon
Commits
16c976ac
Commit
16c976ac
authored
Jun 20, 2016
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split spaceship hull and exhaust, add exhaust animation, sync star rotation with spacecip tilt
parent
c50538f7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
52 deletions
+96
-52
poll.coffee
poll.coffee
+24
-28
style.less
style.less
+66
-21
www/index.html
www/index.html
+6
-3
www/spaiceship.png
www/spaiceship.png
+0
-0
No files found.
poll.coffee
View file @
16c976ac
...
@@ -15,24 +15,20 @@ rand = (lbnd, ubnd) -> Math.round((Math.random() * (ubnd - lbnd)) + lbnd)
...
@@ -15,24 +15,20 @@ rand = (lbnd, ubnd) -> Math.round((Math.random() * (ubnd - lbnd)) + lbnd)
# -- create stars in background --
# -- create stars in background --
star_tails
=
for
_
in
[
1
..
numstars
]
stars
=
for
_
in
[
1
..
numstars
]
size
=
rand
min_star_size
,
max_star_size
red_green
=
rand
180
,
255
x
=
rand
0
,
100
x
=
rand
0
,
100
y
=
rand
0
,
100
y
=
rand
0
,
100
size
=
rand
min_star_size
,
max_star_size
red
=
green
=
rand
180
,
255
star
=
document
.
createElement
'div'
star
=
document
.
createElement
'div'
star
.
style
.
right
=
x
+
'%'
star
.
style
.
right
=
x
+
'%'
star
.
style
.
top
=
y
+
'%'
star
.
style
.
top
=
y
+
'%'
star
.
style
.
width
=
size
+
'px'
star
.
style
.
height
=
size
+
'px'
star
.
style
.
borderRadius
=
size
/
2
+
'px'
star
.
style
.
backgroundColor
=
"rgb(
#{
red
}
,
#{
green
}
, 255)"
document
.
getElementById
(
'stars'
).
appendChild
star
document
.
getElementById
(
'stars'
).
appendChild
star
star
tail
=
document
.
createElement
'div'
tail
.
style
.
backgroundColor
=
"rgb(
#{
red_green
}
,
#{
red_green
}
, 255)"
tail
.
style
.
borderRadius
=
size
/
2
+
'px'
tail
.
style
.
width
=
size
+
'px'
tail
.
style
.
height
=
size
+
'px'
star
.
appendChild
tail
tail
# -- state transitions --
# -- state transitions --
#
#
...
@@ -40,11 +36,11 @@ star_tails = for _ in [1..numstars]
...
@@ -40,11 +36,11 @@ star_tails = for _ in [1..numstars]
spaceship
=
document
.
getElementById
'spaceship'
spaceship
=
document
.
getElementById
'spaceship'
star_heights
=
(
tail
.
style
.
height
for
tail
in
star_tail
s
)
star_heights
=
(
star
.
style
.
height
for
star
in
star
s
)
warp
=
->
warp
=
->
# first stretch stars to create accelerating feel
# first stretch stars to create accelerating feel
Velocity
star
_tail
s
,
Velocity
stars
,
{
width
:
'500px'
},
{
width
:
'500px'
},
{
{
duration
:
1000
,
easing
:
'ease-in'
,
duration
:
1000
,
easing
:
'ease-in'
,
...
@@ -52,21 +48,21 @@ warp = ->
...
@@ -52,21 +48,21 @@ warp = ->
}
}
# then shift
# then shift
for
tail
in
star_tail
s
for
star
in
star
s
amt
=
rand
0
,
20
amt
=
rand
0
,
20
Velocity
tail
,
{
right
:
"+=
#{
amt
}
%"
},
{
duration
:
400
}
Velocity
star
,
{
right
:
"+=
#{
amt
}
%"
},
{
duration
:
400
}
Velocity
tail
,
'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
# speedily to the right and gradually moves back to the center
# speedily to the right and gradually moves back to the center
Velocity
spaceship
,
{
left
:
'-=20%'
,
top
:
'+=20%'
,
},
{
duration
:
1000
}
Velocity
spaceship
,
{
left
:
'-=20%'
},
{
duration
:
1000
}
Velocity
spaceship
,
{
left
:
'+=45%'
,
top
:
'-=45%'
,
},
{
duration
:
400
}
Velocity
spaceship
,
{
left
:
'+=45%'
},
{
duration
:
400
}
Velocity
spaceship
,
{
left
:
'-=25%'
,
top
:
'+=25%'
,
},
{
duration
:
1300
}
Velocity
spaceship
,
{
left
:
'-=25%'
},
{
duration
:
1300
}
unwarp
=
->
unwarp
=
->
# unstretch stars
# unstretch stars
for
tail
,
i
in
star_tail
s
for
star
,
i
in
star
s
Velocity
tail
,
Velocity
star
,
{
width
:
star_heights
[
i
]},
{
width
:
star_heights
[
i
]},
{
{
duration
:
1000
,
easing
:
'ease-in'
,
duration
:
1000
,
easing
:
'ease-in'
,
...
...
style.less
View file @
16c976ac
/* config */
/* config */
@spaceship-width: 400px;
@hull-width: 350px;
@spaceship-height: @spaceship-width * 1447 / 2454;
@cruising-move-radius: 5px;
@cruising-move-radius: 5px;
@cruising-nose-tilt: 6deg;
@cruising-nose-tilt: 6deg;
@cruising-move-duration: 1.5s;
@cruising-move-duration: 1.5s;
@cruising-tilt-duration: 1s;
@cruising-tilt-duration: 1s;
@cruising-exhaust-duration: 500ms;
@cruising-exhaust-scalediff: 0.05;
@excited-move-radius: 10px;
@excited-move-radius: 10px;
@excited-nose-tilt: 16deg;
@excited-nose-tilt: 16deg;
@excited-move-duration: 500ms;
@excited-move-duration: 500ms;
@excited-tilt-duration: 100ms;
@excited-tilt-duration: 100ms;
@excited-exhaust-duration: 150ms;
@excited-exhaust-scalediff: 0.5;
@excited-exhaust-scalebase: 1.2;
@hull-w: 1760;
@hull-h: 1240;
@exhaust-w: 1020;
@exhaust-h: 530;
@hull-height: @hull-width * @hull-h / @hull-w;
@exhaust-width: @exhaust-w / @hull-w * @hull-width;
@exhaust-height: @exhaust-width * @exhaust-h / @exhaust-w;
/* general */
/* general */
...
@@ -23,27 +36,41 @@ img, div {
...
@@ -23,27 +36,41 @@ img, div {
position: absolute;
position: absolute;
}
}
.bg {
.camera {
left: 0;
@camera-extend: 20%;
top: 0;
left: -@camera-extend;
width: 100%;
top: -@camera-extend;
height: 100%;
width: 100 + 2 * @camera-extend;
height: 100 + 2 * @camera-extend;
transform: rotateZ(-25deg);
}
}
.spaceship {
.spaceship {
left: 50%;
left: 50%;
top: 50%;
top: 50%;
width: @
spaceship
-width;
width: @
hull-width + @exhaust
-width;
height: @
spaceship
-height;
height: @
hull
-height;
margin-left: -
@spaceship-width
/ 2;
margin-left: -
(@hull-width + @exhaust-width)
/ 2;
margin-top: -@
spaceship
-height / 2;
margin-top: -@
hull
-height / 2;
z-index: 10;
z-index: 10;
img
{
.rotate-box
{
position:
static
;
position:
relative
;
width: 100%;
width: 100%;
height: 100%;
height: 100%;
}
}
.exhaust {
top: 50%;
right: @hull-width * 0.815;
width: @exhaust-width;
height: @exhaust-height;
margin-top: -@exhaust-height / 2;
}
.hull {
right: 0;
width: @hull-width;
height: @hull-height;
}
}
}
.stars {
.stars {
...
@@ -53,9 +80,6 @@ img, div {
...
@@ -53,9 +80,6 @@ img, div {
height: 100%;
height: 100%;
& > div {
& > div {
// FIXME: this should depend on the market and the client width/height
transform: rotateZ(-25deg);
div {
div {
right: 0;
right: 0;
background-color: white;
background-color: white;
...
@@ -86,12 +110,18 @@ img, div {
...
@@ -86,12 +110,18 @@ img, div {
/* Cruising state */
/* Cruising state */
.cruising .spaceship {
.cruising {
.spaceship {
animation: cruising-movement @cruising-move-duration linear 0s infinite;
animation: cruising-movement @cruising-move-duration linear 0s infinite;
img
{
.rotate-box
{
animation: cruising-rotation @cruising-tilt-duration linear 0s infinite alternate;
animation: cruising-rotation @cruising-tilt-duration linear 0s infinite alternate;
}
}
}
.exhaust {
animation: cruising-exhaust @cruising-exhaust-duration linear 0s infinite alternate;
}
}
}
@keyframes cruising-movement {
@keyframes cruising-movement {
...
@@ -104,14 +134,23 @@ img, div {
...
@@ -104,14 +134,23 @@ img, div {
to { transform: rotateZ(@cruising-nose-tilt / 2) }
to { transform: rotateZ(@cruising-nose-tilt / 2) }
}
}
@keyframes cruising-exhaust {
from { width: @exhaust-width }
to { width: (1 + @cruising-exhaust-scalediff) * @exhaust-width }
}
/* Excited state */
/* Excited state */
.excited .spaceship {
.excited .spaceship {
animation: excited-movement @excited-move-duration linear 0s infinite;
animation: excited-movement @excited-move-duration linear 0s infinite;
img
{
.rotate-box
{
animation: excited-rotation @excited-tilt-duration linear 0s infinite alternate;
animation: excited-rotation @excited-tilt-duration linear 0s infinite alternate;
}
}
.exhaust {
animation: excited-exhaust @excited-exhaust-duration linear 0s infinite alternate;
}
}
}
@keyframes excited-movement {
@keyframes excited-movement {
...
@@ -123,3 +162,9 @@ img, div {
...
@@ -123,3 +162,9 @@ 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-exhaust {
@w: @excited-exhaust-scalebase * @exhaust-width;
from { width: @w }
to { width: (1 + @excited-exhaust-scalediff) * @w }
}
www/index.html
View file @
16c976ac
...
@@ -5,10 +5,13 @@
...
@@ -5,10 +5,13 @@
<link
rel=
"stylesheet"
href=
"style.css"
></link>
<link
rel=
"stylesheet"
href=
"style.css"
></link>
</head>
</head>
<body
class=
"cruising"
>
<body
class=
"cruising"
>
<div
id=
"camera"
class=
"camera"
>
<div
id=
"stars"
class=
"stars"
></div>
<div
id=
"stars"
class=
"stars"
></div>
<div
id=
"bg"
class=
"bg"
>
<div
id=
"spaceship"
class=
"spaceship"
>
<div
id=
"spaceship"
class=
"spaceship"
>
<img
src=
"spaiceship.png"
>
<div
class=
"rotate-box"
>
<img
class=
"exhaust"
src=
"spaiceship-exhaust.png"
>
<img
class=
"hull"
src=
"spaiceship-hull.png"
>
</div>
</div>
</div>
</div>
</div>
<img
class=
"moon"
src=
"moooon.png"
width=
"100"
>
<img
class=
"moon"
src=
"moooon.png"
width=
"100"
>
...
...
www/spaiceship.png
deleted
100644 → 0
View file @
c50538f7
443 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment