JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="animation.css">
 <script src="https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.8.1/gl-matrix-min.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>
<script src="animation.js"></script>
</body>
</html>

CSS

body {
  margin: 0;
	background-color: wheat;
}

#html{
	background-color: wheat;
}
canvas {
  margin: 0;
	position: absolute;
  width: 90vw;
  height: 90vh;
  left: 5vw;
  top: 5vh;
  display: block;
  background-color: rgba(0,0,0,.1);
}

JavaScript

const vertexSource = `
attribute vec4 a_position;
uniform mat4 u_matrix;
void main() {
    gl_Position = u_matrix*a_position;
}`;

const fragmentSource = `
precision mediump float;
void main() {
    gl_FragColor = vec4(255,0,0,1);
}`;



function load() {
  var canvas = document.querySelector("#canvas");
  var gl = canvas.getContext("webgl");
  if(!gl){return;}

  var vertexShader = gl.createShader(gl.VERTEX_SHADER);
  gl.shaderSource(vertexShader,vertexSource);
  gl.compileShader(vertexShader);
  
  var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
  gl.shaderSource(fragmentShader,fragmentSource);
  gl.compileShader(fragmentShader);
  
  var program = gl.createProgram();
  gl.attachShader(program, vertexShader);
  gl.attachShader(program, fragmentShader);
  gl.linkProgram(program);


  matrixLocation=gl.getUniformLocation(program,"u_matrix");
  positionLocation=gl.getAttribLocation(program,"a_position");
  positionBuffer=gl.createBuffer();
  gl.bindBuffer(gl.ARRAY_BUFFER,positionBuffer);
  gl.bufferData(gl.ARRAY_BUFFER,new Float32Array(
    [0,0,0,  .5,.5,0,  .5,0,0,
     0,.1,0,  .5,.6,0,  0,.6,-1]
  ),gl.STATIC_DRAW);
  let bufferLength=6;

  gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
  gl.clear(gl.COLOR_BUFFER_BIT);
  // gl.enable(gl.CULL_FACE);
  // gl.cullFace(gl.BACK);
  gl.enable(gl.BLEND);
  gl.blendEquation( gl.FUNC_ADD );
  gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
  gl.useProgram(program);

  var lookAtMatrix=mat4.create();
  var perspectiveMatrix=mat4.create();
  var uniformMatrix=mat4.create();

  let eye=vec3.fromValues(0,0,1);
  let center=vec3.fromValues(0,0,0);
  let up=vec3.fromValues(0,1,0);
  mat4.lookAt(lookAtMatrix,eye,center,up);
  mat4.perspective(perspectiveMatrix,.9*Math.PI,1,-1,10);
  mat4.multiply(uniformMatrix,uniformMatrix,lookAtMatrix);
  mat4.multiply(uniformMatrix,uniformMatrix,perspectiveMatrix);
  gl.uniformMatrix4fv(matrixLocation,false,uniformMatrix);



 ...