-
Notifications
You must be signed in to change notification settings - Fork 0
/
krazy.html
42 lines (35 loc) · 989 Bytes
/
krazy.html
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
<!DOCTYPE html>
<style>
.foo {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
left: 300px;
}
</style>
<script src='../web-animations-js/web-animations.js'></script>
<script>
var t = document.timeline
</script>
<script type='text/krazy'>
a = [1, 2, 3]
b = map (+) a
map f Nil = Nil
map f (Cons h t) = Cons (f h) (map f t)
id a = a
applyThree q = q 3
record Timing { duration: 0, iterations: 1 }
data :Animation: = AKS Element StringMap Double | AKT Element StringMap Timing
data Group = :ParGroup: [Animation] Timing | :SeqGroup: [Animation] Timing
anim = ParGroup [AKS (:document.querySelector: ".foo") {left: "100px"} 1, AKS (:document.querySelector: ".foo") {transform: 'rotate(45deg)'} 1]
play x = :document.timeline.play: x
main = do
:console.log: a b (map applyThree b)
:console.log: (map id Nil)
:console.log: (map id (Cons 1 Nil))
play anim
</script>
<div class='foo'></div>
<div id='logDiv'></div>
<script src='krazy.js'></script>