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
01829ee6
Commit
01829ee6
authored
Jun 19, 2016
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make star tails separate so that rotation works
parent
5745b898
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
54 deletions
+41
-54
poll.coffee
poll.coffee
+31
-46
style.less
style.less
+10
-8
No files found.
poll.coffee
View file @
01829ee6
...
@@ -15,60 +15,61 @@ rand = (lbnd, ubnd) -> Math.round((Math.random() * (ubnd - lbnd)) + lbnd)
...
@@ -15,60 +15,61 @@ rand = (lbnd, ubnd) -> Math.round((Math.random() * (ubnd - lbnd)) + lbnd)
# -- create stars in background --
# -- create stars in background --
generate_star
=
->
star_tails
=
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
x
=
rand
0
,
100
x
=
rand
0
,
100
y
=
rand
0
,
100
y
=
rand
0
,
100
star
=
document
.
createElement
'div'
star
=
document
.
createElement
'div'
star
.
style
.
backgroundColor
=
"rgb(
#{
red_green
}
,
#{
red_green
}
, 255)"
star
.
style
.
width
=
size
+
'px'
star
.
style
.
height
=
size
+
'px'
star
.
style
.
right
=
x
+
'%'
star
.
style
.
right
=
x
+
'%'
star
.
style
.
top
=
y
+
'%'
star
.
style
.
top
=
y
+
'%'
document
.
getElementById
(
'stars'
).
appendChild
star
document
.
getElementById
(
'stars'
).
appendChild
star
star
# TODO: put tail in nested div for separate animation & rotation, and use
# the .star div as container so that it stays in place
stars
=
(
generate_star
()
for
i
in
[
1
..
numstars
])
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 --
#
#
# there are 3 states: cruising, excited and fullham
# there are 3 states: cruising, excited and fullham
# TODO: transition animations
spaceship
=
document
.
getElementById
'spaceship'
spaceship
=
document
.
getElementById
'spaceship'
warp_spaceship
=
->
star_heights
=
(
tail
.
style
.
height
for
tail
in
star_tails
)
console
.
log
spaceship
Velocity
spaceship
,
{
left
:
'-=20%'
,
top
:
'+=20%'
,
},
{
duration
:
1000
}
Velocity
spaceship
,
{
left
:
'+=45%'
,
top
:
'-=45%'
,
},
{
duration
:
400
}
Velocity
spaceship
,
{
left
:
'-=25%'
,
top
:
'+=25%'
,
},
{
duration
:
1300
}
for
star
in
stars
amt
=
rand
0
,
20
Velocity
star
,
{
right
:
"+=
#{
amt
}
%"
},
{
duration
:
400
}
Velocity
star
,
'reverse'
,
{
duration
:
1000
}
unwarp_spaceship
=
->
warp
=
->
# first stretch stars to create accelerating feel
Velocity
star_tails
,
{
width
:
'500px'
},
{
duration
:
1000
,
easing
:
'ease-in'
}
star_heights
=
(
star
.
style
.
height
for
star
in
stars
)
# then shift
for
tail
in
star_tails
amt
=
rand
0
,
20
Velocity
tail
,
{
right
:
"+=
#{
amt
}
%"
},
{
duration
:
400
}
Velocity
tail
,
'reverse'
,
{
duration
:
1000
}
warp_stars
=
->
# while stars shift, the spaceship goes back a little bit, then launches
Velocity
stars
,
# speedily to the right and gradually moves back to the center
{
width
:
'50%'
},
Velocity
spaceship
,
{
left
:
'-=20%'
,
top
:
'+=20%'
,
},
{
duration
:
1000
}
{
duration
:
1000
,
easing
:
'ease-in'
}
Velocity
spaceship
,
{
left
:
'+=45%'
,
top
:
'-=45%'
,
},
{
duration
:
400
}
Velocity
spaceship
,
{
left
:
'-=25%'
,
top
:
'+=25%'
,
},
{
duration
:
1300
}
unwarp_stars
=
->
unwarp
=
->
for
star
,
i
in
stars
# unstretch stars
Velocity
star
,
for
tail
,
i
in
star_tails
Velocity
tail
,
{
width
:
star_heights
[
i
]},
{
width
:
star_heights
[
i
]},
{
duration
:
1000
,
easing
:
'ease-in'
}
{
duration
:
1000
,
easing
:
'ease-in'
}
transitions
=
transitions
=
cruising_excited
:
[
warp
_stars
,
warp_spaceship
]
cruising_excited
:
[
warp
]
excited_cruising
:
[
unwarp
_stars
]
excited_cruising
:
[
unwarp
]
set_state
=
(
newstate
)
->
set_state
=
(
newstate
)
->
oldstate
=
document
.
body
.
className
oldstate
=
document
.
body
.
className
...
@@ -125,19 +126,3 @@ do ->
...
@@ -125,19 +126,3 @@ do ->
#setInterval poll_exchange, poll_exchange_interval * 1000
#setInterval poll_exchange, poll_exchange_interval * 1000
#setInterval poll_marketcap, poll_marketcap_interval * 1000
#setInterval poll_marketcap, poll_marketcap_interval * 1000
#starels = document.getElementById('stars').getElementsByTagName 'div'
#Velocity(starels, {translateX: [-1000, 0]}, {duration: 200, delay: 1000})
#animate = ->
# spaceship = document.getElementById('spaceship')
# radius = 30
# duration = 4000
#
# options =
# duration: duration / 4
# easing: 'ease-in-out'
#
# Velocity(spaceship,
# { translateX: [-10, 10], translateY: [-10, 10] },
# { duration: 2000, loop: true })
style.less
View file @
01829ee6
...
@@ -52,14 +52,16 @@ img, div {
...
@@ -52,14 +52,16 @@ img, div {
width: 100%;
width: 100%;
height: 100%;
height: 100%;
& > div {
// FIXME: this should depend on the market and the client width/height
// FIXME: this should depend on the market and the client width/height
//
transform: rotateZ(-25deg);
transform: rotateZ(-25deg);
div {
div {
right: 0;
background-color: white;
background-color: white;
width: 10px
;
width: 100%
;
height: 10px
;
height: 100%
;
border-radius: 50%;
}
}
}
}
}
...
...
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