Added posts & fixed pages
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user