examples

helloworld-animate.js

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
pl = display.emoji("🤪")

update(() => {
  pl.pointTo(input)
  pl.move(3)
})

function animate() {
  pl.animate(200, (anim) => {
    anim.scale = 2
    anim.angle += 360
  }, () => {
    pl.animate(200, (anim) => {
      anim.scale = 1
      anim.angle += 360
    })
  })
}

pl.collision((event) => {
  pl.animate(200, (anim) => {
    anim.position = event.other.position
  }, () => {
    animate()
    event.other.hide()
  })
})

repeat(3, () => {
  display.emoji("🍉", random.pos())
})