Added posts & fixed pages

This commit is contained in:
gltron
2022-04-19 19:35:33 +02:00
parent 3d6e616d1a
commit 5df89aad65
8 changed files with 51 additions and 21 deletions

View File

@@ -15,6 +15,7 @@ let incrementer = 0.01;
let reverse = false;
const rotationSpeed = 0.001;
const orbitRadius = 1;
let lastRender = 0
// Helper
function setupContainer (container) {
@@ -84,8 +85,6 @@ async function initModels() {
modelMoon.castShadow = true;
modelMoon.receiveShadow = true;
scene.add(modelMoon);
animateScene();
}
// Animation
@@ -106,17 +105,21 @@ function easeInOut() {
};
function animateScene() {
if ((performance.now() - lastRender) > (1000 / 60)) {
modelPlanet.position.set(1, easeInOut() / 4 + 0.5, 0);
modelPlanet.rotation.y += rotationSpeed;
// const x = Math.cos(incrementer) * orbitRadius;
// const z = Math.sin(incrementer) * orbitRadius;
modelMoon.position.set(0, 1 - easeInOut() - 2, 0);
modelMoon.rotation.y -= rotationSpeed + 0.01;
renderer.render(scene, camera);
}
requestAnimationFrame(animateScene);
modelPlanet.position.set(1, easeInOut() / 4 + 0.5, 0);
modelPlanet.rotation.y += rotationSpeed;
// const x = Math.cos(incrementer) * orbitRadius;
// const z = Math.sin(incrementer) * orbitRadius;
modelMoon.position.set(0, 1 - easeInOut() - 2, 0);
modelMoon.rotation.y -= rotationSpeed + 0.01;
renderer.render(scene, camera);
}
// Main
@@ -124,6 +127,7 @@ export function init() {
initScene();
initLights();
initModels();
animateScene();
}
init();