forked from seidtgeist/lasers
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlasers.coffee
66 lines (54 loc) · 1.6 KB
/
lasers.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
after = (delay, callback) ->
setTimeout callback, delay
every = (interval, callback) ->
setInterval callback, interval
pick = ->
arguments[~~(Math.random() * arguments.length)] unless arguments.length == 0
jQuery(document).ready ($) ->
body = $('body')
heading = $('h1')
party = $('<div/>').attr('id', 'party')
height = $(document).height()
width = $(document).width()
xLasers = ~~(width/70)
yLasers = ~~(height/70)
for i in [0...xLasers]
translateX = i * 70
rotate = -85 + i * 3
transform = "translate(#{translateX}px, 0px) rotate(#{rotate}deg)"
$('<div/>')
.addClass('purple laser')
.css({
'bottom': '-10px'
'left': '0px'
'-webkit-transform': transform
'-moz-transform': transform
'-o-transform': transform
'transform': transform
})
.appendTo(party)
for j in [0...yLasers]
translateY = 70*j
rotate = (j+1)*2
transform = "translate(0px, #{translateY}px) rotate(#{rotate}deg)"
$('<div/>')
.addClass('blue laser')
.css({
'top': '0px'
'left': '-10px'
'-webkit-transform': transform
'-moz-transform': transform
'-o-transform': transform
'transform': transform
})
.appendTo(party)
body.append(party)
# OH MY GOD, IT’S A CALLBACK PINETREE!
every 10000, ->
heading.addClass('no-power')
after 20, ->
heading.removeClass('no-power')
after 500, ->
heading.addClass('no-power')
after 20, ->
heading.removeClass('no-power')