(function() { const canvas = document.getElementById("canvas"); if (canvas.getContext) { const ctx = canvas.getContext("2d"); ctx.reset(); ctx.fillStyle = "rgb(0 0 0)"; const pset = function(x,y) { ctx.fillRect(100-x,100-y,1,1); ctx.fillRect(100-x,100+y,1,1); ctx.fillRect(100+x,100-y,1,1); ctx.fillRect(100+x,100+y,1,1); } const ellipse = function(r,ky,kx) { let t1=(r+kx*ky)/4,x=r,y=0,ty=0,tx=kx*r; while(x>=0) { pset(x,y); if(t1>=0) { ++y; ty+=ky; t1-=ty; } if(t1<0) { --x; tx-=kx; t1+=tx; } } } const ellipse2 = function(rx,ry) { ellipse(rx,rx*rx/ry,ry); } ellipse(40,1,1); ellipse(80,1,1); ellipse(80,2,1); ellipse(80,4,1); ellipse(40,1,2); ellipse(40,1,4); //for(let x=40; x<90; x+=5) ellipse2(x,40); //for(let y=40; y<90; y+=5) ellipse2(40,y); } })();