Skip to content

Instantly share code, notes, and snippets.

@Somrlik
Created April 2, 2020 11:09
Show Gist options
  • Save Somrlik/55b43bb0fafc8c9d190687a47f1b6aec to your computer and use it in GitHub Desktop.
Save Somrlik/55b43bb0fafc8c9d190687a47f1b6aec to your computer and use it in GitHub Desktop.
mandelbrot_666.js
((m,a,n,d,e,l,b,r,o,t)=>{var s=m.createElement("canvas");t.style.margin="0",t.prepend(s),s.style.width="100vw",s.style.height="100vh",t.style.overflow="hidden";var _=s.getContext("2d"),w=t=>{let e=t[0],n=t[1];for(var i=0;i<125;i++){var h=e*e-n*n+t[0],l=2*e*n+t[1];if((e=h)*(n=l)>5)return i/125*100}return 0},f=()=>{s.width=s.clientWidth,s.height=s.clientHeight;var t=48.61/(Math.log(s.width)+5.67)+210,e=s.width/2*1.15,n=s.height/2*.9;for(let i=0;i<s.width;i++)for(let h=0;h<s.height;h++){var l=w([(i-e)/t,(h-n)/t]);_.fillStyle=0===l?"#000":`hsl(0, 100%, ${l}%)`,_.fillRect(i,h,1,1)}};f(),window.addEventListener("resize",f)})(document,0,0,0,0,0,0,0,0,document.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment