JSFiddle - React, Tailwind, and code Playground

by malikzh

HTML

<canvas width="500" height="500" id="c" style="border: 1px solid #666"></canvas>

JavaScript

const ctx = document.getElementById("c").getContext('2d');

ctx.fillStyle = 'rgb(0, 0, 0)';


for(let x=0; x<500; ++x) {

	// Синусоида
	const y = Math.sin((x % 360) * (Math.PI / 180)) * 100;
  
	ctx.fillRect(x, y + 250, 3, 3);
}