Skip to content

Commit

Permalink
load animation automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Jun 24, 2024
1 parent 284b781 commit b62a25e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<body>
<div id="overlay">
<button id="startButton">Play</button>
<button id="loadingButton">Play</button>
</div>
<div id="info">
You trying to access restricted area!<br />
Expand Down
22 changes: 14 additions & 8 deletions libs/personal/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ let ready = false;

const clock = new THREE.Clock();

const startButton = document.getElementById("startButton");
startButton.addEventListener("click", function () {
Ammo().then(function () {
init();
animate();
});
});
// const loadingButton = document.getElementById("loadingButton");
// loadingButton.addEventListener("click", function () {
// Ammo().then(function () {
// init();
// animate();
// });
// });

function init() {
const overlay = document.getElementById("overlay");
Expand Down Expand Up @@ -50,7 +50,7 @@ function init() {
directionalLight.position.set(-1, 1, 1).normalize();
scene.add(directionalLight);

//
// renderer

renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
Expand Down Expand Up @@ -153,3 +153,9 @@ function render() {
}

console.log("Animation loaded!");

// Automatically start the animation
Ammo().then(function () {
init();
animate();
});

0 comments on commit b62a25e

Please sign in to comment.