JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js"></script>
<!doctype html>
<html>
  <head>
    <title>Confetti demo</title>
  </head>
  
 <body onload="RestartConfetti()">

 Confetti demo
 
 <canvas id="canvas"></canvas>
  
 <script>
  
  // globals
    var canvas;
    var ctx;
    var W;
    var H;
    var mp = 75; //max particles
    var particles = [];
    var angle = 0;
    var tiltAngle = 0;
    var confettiActive = true;
    var animationComplete = true;
    var deactivationTimerHandler;
    var reactivationTimerHandler;
    var animationHandler;
		
    // colors
	var calypso = "#00a4bd";
    var sorbet = "#ff8f59";
    var lorax = "#ff7a59";
    var marigold = "#f5c26b";
    var candy_apple = "#f2545b";
    var norman = "#f2547d";
    var thunderdome = "#6a78d1";
    var oz = "00bda5";
    
    
    // objects


    var particleColors = {
        colorOptions: [
          calypso, 
          sorbet, 
          lorax, 
          marigold, 
          candy_apple, 
          norman, 
          thunderdome, 
          oz
        ],
        colorIndex: 0,
        colorIncrementer: 0,
        colorThreshold: 10,
        getColor: function () {
            if (this.colorIncrementer >= 10) {
                this.colorIncrementer = 0;
                this.colorIndex++;
                if (this.colorIndex >= this.colorOptions.length) {
                    this.colorIndex = 0;
                }
            }
            this.colorIncrementer++;
            return this.colorOptions[this.colorIndex];
        }
    }

    function confettiParticle(color) {
        this.x = Math.random() * W; // x-coordinate
        this.y = (Math.random() * H) - H; //y-coordinate
        this.r = RandomFromTo(10, 30); //radius;
        this.d = (Math.random() * mp) + 10; //density;
        this.color = color;
        this.tilt = Math.floor(Math.random() * 10) - 10;
        this.tiltAngleIncremental = (Math.random() * 0.07) + .05;
        this.tiltAngle = 0;

 ...