JSFiddle - React, Tailwind, and code Playground

by marbx

HTML

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script>

JavaScript

t = 0
w = 700

setup =_=> {
  createCanvas(w, w)
  c = w/2
  stroke(c)
}

draw =_=> {
  background(0)
  t += 0.009
  c=w/2
  for (i = 0; i <6; i+=PI/4)
    f(c, c, i, w/7)
  
  //if(t>2*PI){
  // noLoop() 
  //}
}

f = (x, y, r, d) => {
  strokeWeight(d/20);
  if (d > 3) {
    line(x, y, x += cos(r) * d, y -= sin(r) * d)
    f(x, y, r + y / 99 + t, d / 1.5)
    f(x, y, r - y / 99 - t, d / 1.5)
  }
}