Skip to content

Instantly share code, notes, and snippets.

@luizbills
Created April 9, 2024 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizbills/6281d267717031d4806603169f711fa3 to your computer and use it in GitHub Desktop.
Save luizbills/6281d267717031d4806603169f711fa3 to your computer and use it in GitHub Desktop.
move points towards a angle #litecanvas #gamedev
litecanvas();
const max = 3
const dist = 360 / max
function init () {
x = CENTERX
y = CENTERY
a = 0
}
function update (dt) {
a += 180 * dt
if (TAPPED) {
x = TAPX
y = TAPY
}
}
function draw () {
clear(4)
circfill(
x,
y,
5,
3
)
for (let i = 0; i < max; i++) {
circfill(
100 * cos(deg2rad(a + dist * i)) + x,
100 * sin(deg2rad(a + dist * i)) + y,
25,
3
)
}
}