Lissajous Curve [Pico1K Jam]
Souce code:
function _init()
points={}
for c=1,100 do
local p = {
x=0,
y=0
}
add(points,p)
end
t=1
r=30
a1=0
a2=0
v1=0.01
v2=0.01
end
function _update()
if btnp(1) then v1+=0.01 end
if btnp(0) then v1-=0.01 end
if btnp(2) then v2+=0.01 end
if btnp(3) then v2-=0.01 end
v1=mid(0.01,v1,0.09)
v2=mid(0.01,v2,0.09)
a1+=v1
a2+=v2
points[t].x=96+sin(a1)*r
points[t].y=96+cos(a2)*r
t+=1
if t>100 then t=1 end
end
function _draw()
cls()
print ("⬅️ "..v1.." ➡️", 13,94,8)
print ("⬇️ "..v2.." ⬆️", 77,30,12)
circ(32,96,r,9)
circ(96,32,r,3)
circ(32+sin(a1)*r,96+cos(a1)*r,1,8)
circ(96+sin(a2)*r,32+cos(a2)*r,1,12)
line(0,96+cos(a1)*r,127,96+cos(a1)*r,8)
line(96+sin(a2)*r,0,96+sin(a2)*r,127,12)
for p in all(points) do
pset(p.x,p.y,2)
end
end
Leave a comment
Log in with itch.io to leave a comment.