reposition the canvas
This commit is contained in:
@@ -17,5 +17,5 @@ class Main {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<canvas id="canvas"/>
|
<canvas id="rendering_canvas"/>
|
||||||
|
|
||||||
|
@@ -11,14 +11,19 @@ let previousFrame = performance.now();
|
|||||||
|
|
||||||
// Rendering.
|
// Rendering.
|
||||||
const renderer = new THREE.WebGLRenderer({
|
const renderer = new THREE.WebGLRenderer({
|
||||||
canvas: document.querySelector('#canvas'),
|
canvas: document.querySelector('#rendering_canvas'),
|
||||||
});
|
});
|
||||||
renderer.setPixelRatio(window.devicePixelRatio);
|
renderer.setPixelRatio(window.devicePixelRatio);
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
renderer.setAnimationLoop(animate);
|
renderer.setAnimationLoop(animate);
|
||||||
document.body.appendChild(renderer.domElement);
|
document.body.appendChild(renderer.domElement);
|
||||||
|
|
||||||
// Resizing the camera position based on window width.
|
// Change location of canvas.
|
||||||
|
let footer = document.querySelector('#footer');
|
||||||
|
let canvas = document.querySelector('#rendering_canvas');
|
||||||
|
footer.before(canvas);
|
||||||
|
|
||||||
|
// Resizing the camera position based on window width. (change this to be automatic I guess)
|
||||||
if (window.innerWidth <= 400) {
|
if (window.innerWidth <= 400) {
|
||||||
camera.position.z = 6.5;
|
camera.position.z = 6.5;
|
||||||
}
|
}
|
||||||
@@ -31,6 +36,7 @@ else if (window.innerWidth > 650 && window.innerWidth <= 915) {
|
|||||||
camera.position.z = 3.5;
|
camera.position.z = 3.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Lighting.
|
// Lighting.
|
||||||
const light = new THREE.HemisphereLight(0xffffbb, 0x080820, 1);
|
const light = new THREE.HemisphereLight(0xffffbb, 0x080820, 1);
|
||||||
scene.add(light);
|
scene.add(light);
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<footer>
|
<footer id="footer">
|
||||||
<center>
|
<center>
|
||||||
<a href="https://evilr.ing/cjsatnarine/previous"><</a>
|
<a href="https://evilr.ing/cjsatnarine/previous"><</a>
|
||||||
<a href="https://evilr.ing">EVILRING</a>
|
<a href="https://evilr.ing">EVILRING</a>
|
||||||
|
Reference in New Issue
Block a user