examples

circles2.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
34
times(10, (i) => {
  circ=display.circle({ x: 100, y: display.height / 2 }, 4*i)
  circ.delay = 50*i
  circ.color=color.clear
  circ.borderColor=color.hsb(random.num(0,360), 75, 95)
  circ.borderWidth=2
})

input.point((event) => {
  if (!event.ended) { return }

  display.all((elem) => {
    elem.animate({
      duration: 500,
      delay: elem.delay,
      easing: "easeInOutCubic"
    }, (to) => {
      to.position = event.position
    })
  })
})

timer.every(1000, () => {
  pos = random.pos()
  display.all((elem) => {
    elem.animate({
      duration: 500,
      delay: elem.delay,
      easing: "easeInOutCubic"
    }, (to) => {
      to.position = pos
    })
  })
})