JSFiddle - React, Tailwind, and code Playground

by linzoey

CSS

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #7FB0B5;
}

JavaScript

function buildArray (n, fillFunction) {
  let outputArray = [];
  for (let i = 0; i < n; i++) {
    outputArray.push(fillFunction(i))
  }
  return outputArray
}

let draw = SVG().addTo('body').size(1920, 1080)

class Fish {
  constructor (xposition,yposition)
  { 
    this.x = Math.random()*xposition;
    this.y = Math.random()*yposition;
    
  }

  draw () {
var ellipse = draw.ellipse(80, 45).fill('#F3E496').move(this.x+140,this.y+140)
var polyline = draw.polyline('160,15 120,38 160,60')
polyline.fill('#F3E496').move(this.x+205,this.y+140)
var circle = draw.circle(6).fill('#0F1214').move(this.x+160,this.y+155)
var circle = draw.circle(20).fill('#D3E0E9').move(this.x+130,this.y+120)
var circle = draw.circle(30).fill('#D3E0E9').move(this.x+145,this.y+85)
var circle = draw.circle(40).fill('#D3E0E9').move(this.x+170,this.y+40)



  }
}
function fishArray (n) {
    let outputArray = [];
    for (let i = 0; i < n ; i++) {
        outputArray.push(new Fish (1920, 1080, 1000, 1000))
    }
    return outputArray
}

let myFish = fishArray(50);
  for(let i = 0; i < myFish.length ; i++){
    myFish[i].draw();
  }