Play demo
Fourier series in PICO-8 #Pico1k's itch.io pageCharacters/Bytes used
340 characters, totaling 350 bytes. Tried to fit it in a tweet but couldn't.
Source Code
c=camera l=line b=btnp t=0i=0w={}::_::t-=0.0174533if(b(➡️))i+=1
if(b(⬅️))i-=1
cls()c(0,0)?"< > to change iters:"..i,7
c(-32,-64)x=0y=0for i=0,i do px=x py=y n=i*2+1r=20*(4/(n*3.14))x+=r*cos(n*t)y+=r*sin(n*t)circ(px,py,r,5)l(px,py,x,y,7)end l(x,y,32,y, 6)add(w,y,1) if(#w>63)del(w,w[#w])
c(-64,-64)for i=1,#w do pset(i,w[i],7)end flip()goto _
Link to Commented Source Code
https://hastebin.com/vorofuqumu.lua
Leave a comment
Log in with itch.io to leave a comment.
Comments
This is a really neat visualization! Enjoyed squishing the sines into squares and back :)
thanks!
This is a really cool & interesting visualisation.
Nice one! 🤓👍
Very nice! Trimmed to fit in a tweet (279 chars, 279 bytes):
s=-64t=0i=0w={}c=camera::_::t-=.02if(btnp(1))i+=1
if(btnp(0))i-=1
cls()c()?"<>it:"..i
c(-32,s)x=0y=0for n=1,i*2+1,2do p=x q=y r=(25/n)x+=r*cos(n*t)y+=r*sin(n*t)circ(p,q,r,5)line(p,q,x,y,7)end line(x,y,32,y,6)add(w,y,1)deli(w,64)
c(s,s)for i=1,#w do pset(i,w[i],7)end flip()goto _
oh wow, thanks! i never thought about making the -64 a variable, and never thought about using deli either!
you even shortened the string after the shortened print function 😅
this is technically my first ever cart made with a incredibly small amount of characters so if you can help me make it better it would be really appreciated!