Skip to content

Instantly share code, notes, and snippets.

@jhorikawa
Created November 13, 2020 14:57
Show Gist options
  • Save jhorikawa/6ae52f71da6dc1f2fa58b8904fed2294 to your computer and use it in GitHub Desktop.
Save jhorikawa/6ae52f71da6dc1f2fa58b8904fed2294 to your computer and use it in GitHub Desktop.
Source code for PICO-8 to create windmill like motion graphics.
r=64
cr=6
tn=150
d=3
s=0.05
sm=10
trx={}
try={}
for i=1,d do
trx[i]={}
try[i]={}
for n=1,tn do
trx[i][n]=0
try[i][n]=0
end
end
function _draw()
cls(0)
circfill(r,r,cr,7)
circ(r,r,cr+2,7)
rad1=35
rad2=20
for i=1,d do
x1=cos(i/(d)+time()*s)*rad1
y1=sin(i/(d)+time()*s)*rad1
nx1=r+x1
ny1=r+y1
line(r,r,nx1,ny1,7)
circfill(nx1,ny1,cr-3,7)
circ(nx1,ny1,cr-1,7)
circ(nx1,ny1,rad2,5)
x2=cos(i/(d)+time()*s*sm)*rad2
y2=sin(i/(d)+time()*s*sm)*rad2
nx2=nx1+x2
ny2=ny1+y2
line(nx1,ny1,nx2,ny2,7)
circfill(nx2,ny2,cr-6,7)
circ(nx2,ny2,cr-4,7)
add(trx[i],nx2)
add(try[i],ny2)
del(trx[i],trx[i][1])
del(try[i],try[i][1])
end
for i=1,d do
for n=1,tn do
x=trx[i][n]
y=try[i][n]
c=ceil(n/tn*3)+4
pset(x,y,c)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment