how do i put a three.js animation between html tags

how do I put a three.js animation between html syntax? I am trying to put my three.js animation in between the header and the footer but I can’t I tried putting it in a canvas or a div but still not working (I am using a bootstrap template and a grid of cubes animation) here is the code:

Html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <nav class="navbar navbar-expand-lg bg-secondary text-uppercase fixed-top" id="mainNav">
        <div class="container">
            <a class="navbar-brand" href="#page-top">Teamseas</a>
            <button class="navbar-toggler text-uppercase font-weight-bold bg-primary text-white rounded" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                    Menu
                    <i class="fas fa-bars"></i>
                </button>
                <div class="collapse navbar-collapse" id="navbarResponsive">
                    <ul class="navbar-nav ms-auto">
                        <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="#portfolio">Portfolio</a></li>
                        <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="#about">About</a></li>
                        <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="#contact">Contact</a></li>
                    </ul>
                </div>
      </div>
    </nav>








  <script type="module" src="script.js">
  </script>
 <footer class="footer text-center">
  <div class="container">
      <div class="row">
          <!-- Footer Location-->
          <div class="col-lg-4 mb-5 mb-lg-0">
              <h4 class="text-uppercase mb-4">Location</h4>
              <p class="lead mb-0">
                  2215 John Daniel Drive
                  <br />
                  Clark, MO 65243
              </p>
          </div>
          <!-- Footer Social Icons-->
          <div class="col-lg-4 mb-5 mb-lg-0">
              <h4 class="text-uppercase mb-4">Around the Web</h4>
              <a class="btn btn-outline-light btn-social mx-1" href="#!"><i class="fab fa-fw fa-facebook-f"></i></a>
              <a class="btn btn-outline-light btn-social mx-1" href="#!"><i class="fab fa-fw fa-twitter"></i></a>
              <a class="btn btn-outline-light btn-social mx-1" href="#!"><i class="fab fa-fw fa-linkedin-in"></i></a>
              <a class="btn btn-outline-light btn-social mx-1" href="#!"><i class="fab fa-fw fa-dribbble"></i></a>
          </div>
          <!-- Footer About Text-->
          <div class="col-lg-4">
              <h4 class="text-uppercase mb-4">About Freelancer</h4>
              <p class="lead mb-0">
                  Freelance is a free to use, MIT licensed Bootstrap theme created by
                  <a href="http://startbootstrap.com">Start Bootstrap</a>
                  .
              </p>
          </div>
      </div>
  </div>
</footer>
<!-- Copyright Section-->
<div class="copyright py-4 text-center text-white">
  <div class="container"><small>Copyright &copy; Your Website 2021</small></div>
</div>
</body>
</html>

JavaScript

import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js";
import { OrbitControls } from "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/controls/OrbitControls.js";
let s = prompt("g");
function animates(){ 
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
const controls = new OrbitControls(camera, renderer.domElement);

const grid = new THREE.Group();

const cubeSize = 0.5;
const size = Math.cbrt(s);
const gap = 0.01;

const geometry = new THREE.BoxBufferGeometry(
cubeSize,
cubeSize,
cubeSize
);
const material = new THREE.MeshNormalMaterial();
const cubes = new THREE.InstancedMesh(
geometry,
material,
Math.pow(size,3)
);

cubes.instanceMatrix.setUsage(THREE.DynamicDrawUsage);

grid.add(cubes);
scene.add(grid);

const cube = new THREE.Object3D();
const center = (size + gap * (size - 1)) * -0.5;

grid.position.set(center, center, center);
if(s <= 10000){
camera.position.z = 25;
}
else if (s <= 100000){
camera.position.z = 75;
}
else if (s <= 1000000){
    camera.position.z = 100;
    }
(function animate() {
requestAnimationFrame(animate);

let i = 0;
for (let x = 0; x < size; x++) {
for (let y = 0; y < size; y++) {
for (let z = 0; z < size; z++) {
  cube.position.set(x, y, z);
  cube.updateMatrix();
  cubes.setMatrixAt(i, cube.matrix);
  i++;

}
}
}
/*
grid.rotation.x+=0.003;
grid.rotation.y+=0.003;
grid.rotation.z+=0.003;
*/
cubes.instanceMatrix.needsUpdate = true;

controls.update();
renderer.render(scene, camera);
})();
animate();
}
animates();