{"name":"lofi 3d 1","description":"-- lofi 3d 1\n-- alexthescott\n-- 10/20/21 8:12am\n\n-- based on 3d demo\n-- by @noahrosamilia\n\n-- new seed every day of the year \nsrand(31*stat(81)+stat(82)) \n\np1={7,6,135,10,138,11,139,3,131,12,140,1,129,130,128,0}\np2={7,135,10,9,15,143,142,137,14,136,8,2,130,133,128,0}\np3={7,15,143,142,14,8,136,137,9,10,135,138,11,139,12,140}\n\np={p1,p2,p3}\nc=rnd(p)\n\npal(c,1)\n\nfunction draw_shape(s,c)\n\tfor l in all(s[2]) do\n\t\tdraw_line(s[1][l[1]],s[1][l[2]],c)\n\tend\nend\n\nfunction draw_line(p1,p2,c)\n\tx0,y0=project(p1)\n\tx1,y1=project(p2)\n\tline(x0,y0,x1,y1,c)\nend\n\nfunction draw_point(p,c)\n\tx,y=project(p)\n\tpset(x,y,c)\nend\n\nfunction project(p)\n\t-- calculate x,y and center it\n\tx=(p[1]-cam[1])*mult/(p[3]-cam[3])+127/2\n\ty=-(p[2]-cam[2])*mult/(p[3]-cam[3])+127/2\n\treturn x,y\nend\n\nfunction translate_shape(s,t)\n\t-- copy shape, 0 out points,\n\t-- keep og lines\n\tns={{},s[2]}\n\t-- add displacement to point\n\tfor p in all(s[1])do\n\t\tadd(ns[1],{p[1]+t[1],p[2]+t[2],p[3]+t[3]})\n\tend\n\treturn ns\nend\n\nfunction rotate_shape(s,a,r)\n\t-- copy shape, 0 out points\n\t-- keep og lines\n\tns={{},s[2]}\n\tfor p in all(s[1])do\n\t\tadd(ns[1],rotate_point(p,a,r))\n\tend\n\treturn ns\nend\n\nfunction rotate_point(p,a,r)\n\t-- figure axis we're rotating\n\tif a==1 then\n\t\tx,y,z=3,2,1\n\telseif a==2 then\n\t\tx,y,z=1,3,2\n\telseif a==3 then\n\t\tx,y,z=1,2,3\n\tend\n\t\n\t_x=cos(r)*p[x]-sin(r)*p[y]\n\t_y=sin(r)*p[x]+cos(r)*p[y]\n\tnp={}\n\tnp[x]=_x\n\tnp[y]=_y\n\tnp[z]=p[z]\n\treturn np\nend\n\nfunction limit_int(v,l)\n\tif v>0 then\n\t\treturn min(v,l)\n\telse\n\t\treturn max(v,-l)\n\tend\nend\n\nfunction burn()\n\tfor p=0,384 do\n\t\tx=rnd(128)\\1\n\t\ty=rnd(128)\\1\n\t\tpc=pget(x,y)\n\t\tif pc!=0 then\n\t\t\tpset(x,y,pc-1)\n\t\telse\n\t\t\tpset(x,y,0)\n\t\tend\n\tend\nend\n\nfunction fuzz(big)\n\tif big then\n\t\tsz=10\n\t\tcnt=512\n\telse\n\t\tsz=3\n\t\tcnt=384\n\tend\n\n\tfor p=0,cnt do\n\t\tx=rnd(128)\\1\n\t\ty=rnd(128)\\1\n\t\tpc=pget(x,y)\n\t\tif pc!=0 then\n\t\t\tfor l=1,rnd(sz)\\1 do\n\t\t\tpset(x-l,y,pc)\n\t\t\tpset(x+l,y,pc)\n\t\t\tend\n\t\tend\t\t\n\tend\nend\n\nfunction forward()\n\tv=c[1]\n\tdel(c,v)\n\tc[#c+1]=v\n\tpal(c,1)\nend\n\nfunction backward()\n\tv=c[#c]\n\tdel(c,v)\n\tfor i=#c+1,1,-1 do\n\t\tif i!=1 then\n\t\t\tc[i]=c[i-1]\n\t\telse\n\t\t\tc[i]=v\n\t\tend\n\tend\n\tpal(c,1)\nend\n\nfor i=1,rnd()*16 do\n\tforward()\nend\n\ncube={\n\t--points\n\t{{-1,-1,-1},\n\t{-1,-1,1},\n\t{1,-1,1},\n\t{1,-1,-1},\n\t{-1,1,-1},\n\t{-1,1,1},\n\t{1,1,1},\n\t{1,1,-1}},\n\t--lines\n\t{{1,2},{2,3},\n\t{3,4},{4,1},\n\t{5,6},{6,7},\n\t{7,8},{8,5},\n\t{1,5},{2,6},\n\t{3,7},{4,8}}\n}\nsz2=2/3\ncube2={\n\t--points\n\t{{-sz2,-sz2,-sz2},\n\t{-sz2,-sz2,sz2},\n\t{sz2,-sz2,sz2},\n\t{sz2,-sz2,-sz2},\n\t{-sz2,sz2,-sz2},\n\t{-sz2,sz2,sz2},\n\t{sz2,sz2,sz2},\n\t{sz2,sz2,-sz2}},\n\t--lines\n\t{{1,2},{2,3},\n\t{3,4},{4,1},\n\t{5,6},{6,7},\n\t{7,8},{8,5},\n\t{1,5},{2,6},\n\t{3,7},{4,8}}}\n\t\nsz3=1/3\ncube3={\n\t--points\n\t{{-sz3,-sz3,-sz3},\n\t{-sz3,-sz3,sz3},\n\t{sz3,-sz3,sz3},\n\t{sz3,-sz3,-sz3},\n\t{-sz3,sz3,-sz3},\n\t{-sz3,sz3,sz3},\n\t{sz3,sz3,sz3},\n\t{sz3,sz3,-sz3}},\n\t--lines\n\t{{1,2},{2,3},\n\t{3,4},{4,1},\n\t{5,6},{6,7},\n\t{7,8},{8,5},\n\t{1,5},{2,6},\n\t{3,7},{4,8}}\n\t}\n\ncam={0,0,-2.5}\nmult=64\na1_1=1+rnd(3)\\1\na2_1=1+rnd(3)\\1\na1_2,a1_3=a1_1,a1_1\na2_2,a2_3=a2_1,a2_1\nwhile a1_1==a2_1 do\n\ta2_1=1+rnd(3)\\1\n\ta2_2,a2_3=a2_1,a2_1\nend\nt1=50+rnd(50)\\1\nt2=t1+20\nt3=t2+40\n\nt_gap=5+(5*rnd())\\1\n\nburn_count=3+(40*rnd())\\1\nburn_var=5+(15*rnd())\\1\n\nshow_center_circ=rnd()>0.5\nshow_outside_circ=rnd()>0.5\n\nmonth=stat(81)\nday=stat(82)\n\ncls()\n_set_fps(60)\n::♥::\nif t()<2 then\n\tprint(\"lofi 3d 1\",46,59,1)\n\tprint(month..\"/\"..day,55,65)\nelse\n\n\tif btn(❎) and btn(🅾️) or \n\t\ttime()%burn_var==0 then\n\t\t\tburn_count=3+(40*rnd())\\1\n\t\t\tburn_var=5+(15*rnd())\\1\n\t\t\tburn()\n\telseif burn_count>0 then\n\t\tburn()\n\t\tburn_count-=1\n\telse\n\t\tcls()\n\tend\n\t\n\tif btn(⬅️) then cam[1] -= 0.1 end\n\tif btn(➡️) then cam[1] += 0.1 end\n\tif btn(⬆️) then cam[2] += 0.1 end\n\tif btn(⬇️) then cam[2] -= 0.1 end\n\tif btn(❎) then cam[3] -= 0.1 end\n\tif btn(🅾️) then cam[3] += 0.1 end\n\t\n\tif btn(⬆️) and btn(⬇️) or\n\t\tbtn(➡️) and btn(⬅️) then\n\t\t\tprint(\"cam.x=\"..cam[1],0,0,2)\n\t\t\tprint(\"cam.y=\"..cam[2],0,6,2)\n\t\t\tprint(\"cam.z=\"..cam[3],0,12,2)\n\t\t\t\n\t\t\tprint(\"t1=\"..t1,0,110,t1/t_gap)\n\t\t\tprint(\"t2=\"..t2,0,116,t2/t_gap)\n\t\t\tprint(\"t3=\"..t3,0,122,t3/t_gap)\n\tend\n\t\n\tt1-=1\n\tt2-=1\n\tt3-=1\n\t\n\tif t1<0 then\n\t\ta1_1=1+rnd(3)\\1\n\t\ta2_1=1+rnd(3)\\1\n\t\twhile a1_1==a2_1 do\n\t\t\ta2_1=1+rnd(3)\\1\n\t\tend\n\t\tt1=50+rnd(50)\\1\n\tend\n\t\n\tif t2<0 then\n\t\tt2=t1+20\n\t\ta1_2,a2_2=a1_1,a2_1\n\tend\n\t\n\tif t3<0 then\n\t\tt3=t1+40\n\t\ta1_3,a2_3=a1_1,a2_1\n\tend\n\t\n\tcube=rotate_shape(cube,a1_1,0.004)\n\tcube=rotate_shape(cube,a2_1,0.004)\n\tcube2=rotate_shape(cube2,a1_2,0.004)\n\tcube2=rotate_shape(cube2,a2_2,0.004)\n\tcube3=rotate_shape(cube3,a1_3,0.004)\n\tcube3=rotate_shape(cube3,a2_3,0.004)\n\t\n\tif show_center_circ then\n\t\tfillp(0b1111110111111111)\n\t\tcircfill(64,64,20,1)\n\t\tfillp(0b111110111111111)\n\t\tcircfill(64,64,15,1)\n\t\tfillp()\n\t\tcircfill(64,64,10,0)\n\tend\n\t\n\tdraw_shape(cube,t1/t_gap)\n\tdraw_shape(cube2,t2/t_gap)\n\tdraw_shape(cube3,t3/t_gap)\n\t\n\tif(show_outside_circ) circ(64,64,62,1)\n\t\n\tif btn(🅾️) or btn(❎) then\n\t\tfuzz(true)\n\telse\n\t\tfuzz(false)\n\tend\t\nend\nflip()\ngoto ♥","tags":["pico-8","pico8","interactive"],"symbol":"OBJKT","artifactUri":"ipfs://QmVwEsFjxrUG3bQh67KeLwtBdbdryMcLbMFf9ki1MSQDdh","displayUri":"ipfs://QmeYHziw5dN4x8zxcNiqsXThvjgXZ4CxTgY25Gq3kVDG1c","thumbnailUri":"ipfs://QmNrhZHUaEqxhyLfqoq1mtHSipkWHeT31LNHb1QEbDHgnc","creators":["tz1St3n29AbYXZXV8W1BG41qYzz86J2CFAW7"],"formats":[{"uri":"ipfs://QmVwEsFjxrUG3bQh67KeLwtBdbdryMcLbMFf9ki1MSQDdh","mimeType":"application/x-directory"}],"decimals":0,"isBooleanAmount":false,"shouldPreferSymbol":false}