Skip to content

Instantly share code, notes, and snippets.

@gilberto-009199
Created March 12, 2024 01:18
Show Gist options
  • Save gilberto-009199/e5fd0550d4477d84d6fb2cdc6ddeb1f5 to your computer and use it in GitHub Desktop.
Save gilberto-009199/e5fd0550d4477d84d6fb2cdc6ddeb1f5 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
</head>
<body>
<script type="module">
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.162.0/+esm'
const width = window.innerWidth, height = window.innerHeight;
// init
const camera = new THREE.PerspectiveCamera( 70, width / height, 0.01, 10 );
camera.position.z = 1;
const scene = new THREE.Scene();
//const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
const points = [];
points.push( new THREE.Vector3( - 10, 0, 0 ) );
points.push( new THREE.Vector3( 0, 10, 0 ) );
points.push( new THREE.Vector3( 10, 0, 0 ) );
const geometry = new THREE.BufferGeometry().setFromPoints( points );
const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
const line = new THREE.Line( geometry, material );
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( width, height );
//renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );
renderer.render( scene, camera );
</script>
<style>
/*:root {
--primary-color-active: rgb(38, 203, 124);
--primary-color: #00c58e;
}
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji,
Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
margin: 0;
background-color: #333;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Roboto', sans-serif;
}
nav{
height: auto;
overflow: auto;
display: block;
width: 100%;
}
main{
width: 100%;
height: 100vh;
max-height: 100vh;
overflow: hidden;
width: 100%;
display: block;
}*/
</style>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment