examples
_animations
- animating-circles.js
- circle-grid.js
- circles-border-timer.js
- circles-inout.js
- circles.js
- cloud-delay.js
- clown.js
- drops.js
- grid.js
- helloworld-animate.js
- keyframe.js
- shapes-border.js
- square-grid.js
- squares-border-timer.js
- squares-timer-overlap.js
- troll.js
- circles2.js
- helloworld-animate2.js
- keyframe2.js
- keyframe3.js
_audio
_gravity
_particles
_sub
display
movement
- arrows-aim-shoot.js
- arrows-line.js
- arrows-rotate.js
- arrows-shift.js
- arrows-x.js
- arrows-y.js
- drag-drop.js
- falling-click.js
- follow-line.js
- follow-x.js
- follow-y.js
- follow.js
- if-on-edge-bounce.js
- input-aim-shoot.js
- input-point-goto.js
- input-point-moveto.js
- joystick.js
- strech-back-release-physics.js
- stretch-front-release-physics.js
- stretch-front-release.js
- drag-drop2.js
physics
showcase
tests
user-interface
physics-test2.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
35
36
37
world.frame()
//physics.debug()
fill(color.hsb(0, 0, 100, 10))
stroke(color.white, 2)
emo = display.emoji("🤩", 480, 100)
physics.add(emo, { radius: emo.width/2 })
els = [
display.star(100, 100, 30),
display.rect(250, 100, 50, 50),
emo,
display.polygon(480, 320, 30, 8),
display.circle(550, 100, 30),
display.ellipse(860, 100, 30, 40)
]
for (let el of els) {
if (["star", "polygon"].includes(el.tag)) {
el.randomize = 0.3
}
//el.createVerts(0.3)
el.click((e) => {
e.self.pointTo(e.position)
e.self.moveImpulse(50)
})
physics.add(el)
el.animate(400, (to) => {
to.scale = 2
to.angle = 25
})
}