examples

drag-release.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
world.frame(0,0,1920,640)

display.color=color.hsb(197, 42, 92)

poly = display.emoji("🤩", 100, 500)

physics.add(poly, { radius: 37.5, bounce: 0.7 })
camera.follow(poly)

poly.point((event) => {
  if (event.ended) {
    poly.applyImpulse(
      poly.position.x - event.position.x,
      poly.position.y - event.position.y
    )
  }
})

physics.add(
  display.rect(world.width/2, 625, world.width-5, 50),
  { type: "static" }
)

times(10, () => {
  display.cloud(random.pos(), 38)
})