Commit e0499b35 authored by Louise Picot's avatar Louise Picot

test three.js

parent 92c79ca7
......@@ -48,8 +48,9 @@
}
.test{
width: 200px;
}
body {
/* background-color: rgb(24, 22, 22); */
font-family: arial;
......@@ -62,7 +63,7 @@ body {
@media print {
@page {
size: 297mm 210mm;
size: 210mm 297mm;
/* border: 1px solid; */
/* margin: 10mm 10mm; */
......@@ -103,6 +104,18 @@ body {
color: #426bf4;
}
@page backmatter {
margin: 20mm 30mm;
background: yellow;
}
.backmatter {
page: backmatter;
}
@page :first {
background: red;
}
}
\ No newline at end of file
......@@ -12,14 +12,20 @@
<body>
<div class="test">
<h1 class="backmatter">BLABLALBAAA</h1>
<div id="container" ></div>
</div>
<script src="librairies/three-js/three.js"></script>
<script src="librairies/three-js/OrbitControls.js"></script>
<script src="js/script.js"></script>
<script src="js/three-script.js"></script>
<script src="js/poster-3d.js"></script>
<!-- <script src="js/three-script.js"></script> -->
</body>
......
let scene = new THREE.Scene(),
renderer = window.WebGLRenderingContext ? new THREE.WebGLRenderer() : new THREE.CanvasRenderer(),
light = new THREE.AmbientLight(0xffffff),
camera,
box;
const initScene = () => {
renderer.setSize(500, 500);
renderer.setClearColor(0xffffff, 1)
document.getElementById('container').appendChild(renderer.domElement);
scene.add(light)
camera = new THREE.PerspectiveCamera(35, 500 / 500, 1, 1000)
camera.position.set(85, 20, 85);
camera.lookAt(scene.position)
scene.add(camera)
let boxMaterial = new THREE.MeshBasicMaterial({
map: new THREE.TextureLoader().load("../assets/images/posters/pppink.png")
})
box = new THREE.Mesh(
new THREE.CubeGeometry(35, 55, 35),
boxMaterial,
)
// box.rotation.y = 40;
// box.rotation.x = 90;
// box.rotation.z = 60;
box.name = "box";
scene.add(box)
// controls = new THREE.OrbitControls(camera)
// controls.addEventListener('change', render)
render();
}
const render = () => {
box.rotation.y += 0.01
renderer.render(scene, camera);
requestAnimationFrame(render);
}
window.onload = initScene;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment