examples

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

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

pl.collision((event) => {
  event.other.hide()

  pl.animateKeyframe((anim) => {
    anim.keyframe(
      {t: 200, easing: Easing.easeOutSine },
      (to) => {
        to.position = event.other.position
      })
    anim.keyframe(
      {t: 200, easing: Easing.easeInOutSine },
      (to) => {
        to.scale = 2
        to.angle += 360
      })
    anim.keyframe(
      {t: 200, easing: Easing.easeInSine },
        (to) => {
        to.scale = 1
      })
  })
})

timer.every(3000, () => {
  display.emoji("🍉", random.pos())
})