Skip to content

Commit 4e135fc

Browse files
author
Juho Räsänen
committed
standard implemented
1 parent 187f7ee commit 4e135fc

File tree

8 files changed

+3563
-577
lines changed

8 files changed

+3563
-577
lines changed

.devcontainer/devcontainer.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,28 @@
1010
"5173": {
1111
"label": "Vite"
1212
}
13-
}
14-
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"files.eol": "\n",
18+
"standard.enable": true,
19+
"standard.run": "onType",
20+
"standard.autoFixOnSave": true
21+
},
22+
"extensions": [
23+
"standard.vscode-standard"
24+
]
25+
}
26+
},
1527
// Features to add to the dev container. More info: https://containers.dev/features.
1628
// "features": {},
17-
1829
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1930
// "forwardPorts": [],
20-
2131
// Use 'postCreateCommand' to run commands after the container is created.
22-
// "postCreateCommand": "uname -a",
23-
32+
"postCreateCommand": "npm install"
2433
// Configure tool-specific properties.
2534
// "customizations": {},
26-
2735
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
2836
// "remoteUser": "root"
29-
}
37+
}

.gitignore

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
node_modules
2-
dist
2+
dist
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# graffathon-2023
2+
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)
23

34
### Music credit
45
Music by [SoulProdMusic](https://pixabay.com/music/beats-smoke-143172/) - [Smoke](https://pixabay.com/music/beats-smoke-143172/)

main.js

+50-56
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,64 @@
1-
import * as THREE from 'three';
1+
import * as THREE from 'three'
22
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'
33
import Stats from 'three/addons/libs/stats.module.js'
44

55
import { Stencil } from './scenes/stencil'
66
import { StencilBLue } from './scenes/stencil-blue'
77

8-
let scene, renderer, stats, controls;
9-
10-
init();
11-
animate();
12-
13-
function init() {
14-
15-
scene = new Stencil();
16-
17-
// Stats
18-
stats = new Stats();
19-
document.body.appendChild( stats.dom );
20-
21-
// Renderer
22-
renderer = new THREE.WebGLRenderer( { antialias: true } );
23-
renderer.shadowMap.enabled = true;
24-
renderer.setPixelRatio( window.devicePixelRatio );
25-
renderer.setSize( window.innerWidth, window.innerHeight );
26-
renderer.setClearColor( 0x263238 );
27-
28-
window.addEventListener( 'resize', onWindowResize );
29-
document.body.appendChild( renderer.domElement );
30-
31-
renderer.localClippingEnabled = true;
32-
33-
setTimeout(() => {
34-
scene = new StencilBLue();
35-
const controls = new OrbitControls( scene.getCamera, renderer.domElement );
36-
controls.minDistance = 2;
37-
controls.maxDistance = 20;
38-
controls.enabled = false;
39-
controls.update();
40-
}, 5000);
41-
42-
// Controls
43-
const controls = new OrbitControls( scene.getCamera, renderer.domElement );
44-
controls.minDistance = 2;
45-
controls.maxDistance = 20;
46-
controls.enabled = false;
47-
controls.update();
48-
8+
let scene, renderer, stats
9+
10+
init()
11+
animate()
12+
13+
function init () {
14+
scene = new Stencil()
15+
16+
// Stats
17+
stats = new Stats()
18+
document.body.appendChild(stats.dom)
19+
20+
// Renderer
21+
renderer = new THREE.WebGLRenderer({ antialias: true })
22+
renderer.shadowMap.enabled = true
23+
renderer.setPixelRatio(window.devicePixelRatio)
24+
renderer.setSize(window.innerWidth, window.innerHeight)
25+
renderer.setClearColor(0x263238)
26+
27+
window.addEventListener('resize', onWindowResize)
28+
document.body.appendChild(renderer.domElement)
29+
30+
renderer.localClippingEnabled = true
31+
32+
setTimeout(() => {
33+
scene = new StencilBLue()
34+
const controls = new OrbitControls(scene.getCamera, renderer.domElement)
35+
controls.minDistance = 2
36+
controls.maxDistance = 20
37+
controls.enabled = false
38+
controls.update()
39+
}, 5000)
40+
41+
// Controls
42+
const controls = new OrbitControls(scene.getCamera, renderer.domElement)
43+
controls.minDistance = 2
44+
controls.maxDistance = 20
45+
controls.enabled = false
46+
controls.update()
4947
}
5048

51-
function onWindowResize() {
52-
53-
scene.getCamera.aspect = window.innerWidth / window.innerHeight;
54-
scene.getCamera.updateProjectionMatrix();
55-
56-
renderer.setSize( window.innerWidth, window.innerHeight );
49+
function onWindowResize () {
50+
scene.getCamera.aspect = window.innerWidth / window.innerHeight
51+
scene.getCamera.updateProjectionMatrix()
5752

53+
renderer.setSize(window.innerWidth, window.innerHeight)
5854
}
5955

60-
function animate() {
61-
62-
requestAnimationFrame( animate );
63-
64-
scene.animate()
56+
function animate () {
57+
window.requestAnimationFrame(animate)
6558

66-
stats.begin();
67-
renderer.render( scene.getScene, scene.getCamera );
68-
stats.end();
59+
scene.animate()
6960

61+
stats.begin()
62+
renderer.render(scene.getScene, scene.getCamera)
63+
stats.end()
7064
}

0 commit comments

Comments
 (0)