Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
faafaa123 committed Oct 23, 2024
0 parents commit 60df700
Show file tree
Hide file tree
Showing 7 changed files with 998 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# daily-dashboard

13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>threeJS-FinanceIO</title>
<style>
body { margin: 0; }
</style>
</head>
<body>
<script type="module" src="/main.ts"></script>
</body>
</html>
73 changes: 73 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import * as THREE from 'three';
// @ts-ignore
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

let camera: THREE.OrthographicCamera;
let controls: any;
let scene: THREE.Scene;
let renderer: THREE.Renderer;

async function init() {
// setup scene and renderer
scene = new THREE.Scene();
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

// Set up an OrthographicCamera
const aspect = window.innerWidth / window.innerHeight;
const frustumSize = 100;
camera = new THREE.OrthographicCamera(
frustumSize * aspect / - 2, // left
frustumSize * aspect / 2, // right
frustumSize / 2, // top
frustumSize / - 2, // bottom
0.1, // near
1000 // far
);
camera.position.set(0, 100, 100); // Position the camera
camera.lookAt(0, 0, 0); // Look at the center of the scene

// Adding a flat plane
const geometry = new THREE.PlaneGeometry(200, 200);
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00, side: THREE.DoubleSide });
const plane = new THREE.Mesh(geometry, material);
plane.rotation.x = Math.PI / 2; // Rotate the plane to lie flat
scene.add(plane);

// show axis
const axesHelper = new THREE.AxesHelper(5000);
axesHelper.setColors('#fc0303', '#036ffc', '#03fc17')
// scene.add(axesHelper);

// setup orbitControls
controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.screenSpacePanning = false;
controls.maxPolarAngle = Math.PI / 2;
controls.target = new THREE.Vector3(1, 1, 1)

// setup light
const hemiLight = new THREE.HemisphereLight(0xffffbb, 0x080820, 0.3);
scene.add(hemiLight);
const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(0, 1, 1).normalize();
scene.add(light);

}


function animate() {
requestAnimationFrame(animate);
render()
}

function render() {
renderer.render(scene, camera);
}


init().then(() => {
animate();
})
Loading

0 comments on commit 60df700

Please sign in to comment.