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
| display.color=color.hsb(0,0,0,5)
let grv = display.circle(display.center, 100)
grv.color = color.clear
grv.tag = "gravity"
input.point((e) => {
grv.position = e.position
})
cent = display.center
times(1000, () => {
let orb = display.circle(random.pos(), 1)
if (orb.x < cent.x && orb.y < cent.y) {
orb.velocity = new Point(0.5, 0)
} else
if (orb.x > cent.x && orb.y < cent.y) {
orb.velocity = new Point(0, 0.5)
} else
if (orb.x > cent.x && orb.y > cent.y) {
orb.velocity = new Point(-0.5, 0)
} else
if (orb.x < cent.x && orb.y > cent.y) {
orb.velocity = new Point(0, -0.5)
}
orb.color = color.hsb(random.num(0,360), 75, 95)
})
update(() => {
display.each("circle", (el) => {
grv.forceOn(el, 0.005)
})
})
|
display.color=color.hsb(0,0,0,5)
let grv = display.circle(display.center, 100)
grv.color = color.clear
grv.tag = "gravity"
input.point((e) => {
grv.position = e.position
})
cent = display.center
times(1000, () => {
let orb = display.circle(random.pos(), 1)
if (orb.x < cent.x && orb.y < cent.y) {
orb.velocity = new Point(0.5, 0)
} else
if (orb.x > cent.x && orb.y < cent.y) {
orb.velocity = new Point(0, 0.5)
} else
if (orb.x > cent.x && orb.y > cent.y) {
orb.velocity = new Point(-0.5, 0)
} else
if (orb.x < cent.x && orb.y > cent.y) {
orb.velocity = new Point(0, -0.5)
}
orb.color = color.hsb(random.num(0,360), 75, 95)
})
update(() => {
display.each("circle", (el) => {
grv.forceOn(el, 0.005)
})
})