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
camera-ui.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
world.frame(0, 0, 1920, 1280)
pnt = { x: 2, y: 2 }
pl = camera.follow(display.emoji("🤩", 101, 101))
pl.update(() => {
pl.position.x += pnt.x
pl.position.y += pnt.y
if ((pl.position.x < world.x + 100) || (pl.position.x > world.width - 100)) {
pnt.x = -pnt.x
}
if ((pl.position.y < world.y + 100) || (pl.position.y > world.height - 100)) {
pnt.y = -pnt.y
}
})
lbl = display.text("See me!", display.width/2, 100)
btn = display.button("Click me!", display.width/2, 600)
//btn.fontSize = 40
btn.color = color.hsb(0, 0, 90)
btn.backgroundColor = color.hsb(0, 0, 10)
btn.activeBackgroundColor = color.hsb(75, 75, 95)
btn.activeColor = color.hsb(0, 0, 15)
btn.borderColor = color.hsb(0, 0, 90)
btn.borderWidth = 2
//btn.inset = { top: -5, left: -8, bottom: 5, right: 8 }
btn.action(() => {
print("Clicked!", Date.now())
lbl.text = `Clicked ${Date.now()}`
})
ranpos = random.pos()
rannum = random.number(3, 10)
print("ranpos", ranpos, "rannum", rannum)
circ = display.circle(ranpos.x, ranpos.y, rannum)
//timer.every(200, () => {
// initVal = 0
// for (var i=0; i < display.drawElems.count; i++) {
// if (display.drawElems[i].inView()) {
// initVal += 1
// }
// }
// print("inView", initVal)
//})
//circ.update(() => {
// print("inView", circ.inView())
//})
repeat(50, (fired) => {
//print("fired", fired)
//display.emoji("🔥", random.pos())
display.circle(random.pos(), random.number(10, 50))
})