Skip to content

Commit 9a449ea

Browse files
author
Juho Räsänen
committed
final
1 parent e1f6fcf commit 9a449ea

File tree

5 files changed

+55
-51
lines changed

5 files changed

+55
-51
lines changed

main.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'
1717
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'
1818
import { Credits } from './scenes/credits'
1919
import { Viuh } from './scenes/viuh'
20+
import { CubeRubber } from './scenes/CubeRubber'
21+
import { SnakeBirth } from './scenes/SnakeBirth'
2022

2123
let scene, scenes, renderer, stats, composer, current, timeout
22-
import { CubeRubber } from './scenes/CubeRubber'
2324

2425
init()
2526

@@ -51,34 +52,36 @@ const loop = i => {
5152

5253
function init () {
5354
scenes = [
55+
{
56+
scene: new SnakeBirth(),
57+
time: 5000
58+
},
5459
{
5560
scene: new Viuh(),
5661
time: 6000
5762
},
5863
{
5964
scene: new CityAtStreetLevel(),
60-
time: 10000
65+
time: 7500
6166
},
6267
{
6368

6469
scene: new CityFromWindow(),
65-
time: 8000
70+
time: 9700
6671
},
6772
{
6873
scene: new CubeRubber(),
69-
time: 6500,
74+
time: 7500
7075
},
7176
{
7277
scene: new Explosion(),
7378
time: 10000
7479
},
7580
{
76-
scene: new Credits(),
77-
time: 10000,
81+
scene: new Credits()
7882
}
7983
]
8084

81-
8285
// Stats
8386
stats = new Stats()
8487

@@ -151,6 +154,9 @@ function init () {
151154
})
152155
music.addEventListener('ended', () => {
153156
welcomeGUI.show()
157+
if (document.exitFullscreen) {
158+
document.exitFullscreen()
159+
}
154160
})
155161
}
156162

return.zip

989 Bytes
Binary file not shown.

return/start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# But the timeout should be there so we don't have to manually shut
55
# down the server after the demo ends. If your demo needs more than
66
# 30s to load, you can increase the timeout.
7-
timeout 30s python3 -m http.server -d 'dist' 3000 &
7+
timeout 60s python3 -m http.server -d 'dist' 3000 &
88

99
# The Linux compo machine doesn't have Chrome, contact us if you need it.
1010
google-chrome --start-fullscreen --new-window 'http://localhost:3000'

scenes/credits.js

+40-42
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,87 @@
1-
import * as THREE from "three";
2-
import { TextGeometry } from "three/addons/geometries/TextGeometry.js";
3-
import { FontLoader } from "three/addons/loaders/FontLoader.js";
1+
import * as THREE from 'three'
2+
import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'
3+
import { FontLoader } from 'three/addons/loaders/FontLoader.js'
44

5-
import { FilmShader } from "three/addons/shaders/FilmShader.js";
6-
import { ShaderPass } from "three/addons/postprocessing/ShaderPass.js";
5+
import { FilmShader } from 'three/addons/shaders/FilmShader.js'
6+
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'
77

8-
import fontJson from "../assets/fonts/monsieur.json";
8+
import fontJson from '../assets/fonts/monsieur.json'
99

10-
let shader;
10+
let shader
1111

1212
let upDir = true
1313

1414
class Credits {
15-
constructor() {
16-
this.scene = new THREE.Scene();
17-
this.scene.background = new THREE.Color(0x000);
15+
constructor () {
16+
this.scene = new THREE.Scene()
17+
this.scene.background = new THREE.Color(0x000)
1818

1919
this.camera = new THREE.PerspectiveCamera(
2020
70,
2121
window.innerWidth / window.innerHeight,
2222
1,
2323
100
24-
);
25-
this.camera.position.set(-73, -3, 80);
24+
)
25+
this.camera.position.set(-73, -3, 80)
2626

2727
shader = new ShaderPass(FilmShader)
28-
shader.uniforms["nIntensity"].value = 1;
28+
shader.uniforms.nIntensity.value = 1
2929

30-
shader.uniforms["sCount"].value = 30;
31-
shader.uniforms["sIntensity"].value = 1;
30+
shader.uniforms.sCount.value = 30
31+
shader.uniforms.sIntensity.value = 1
3232

33-
const loader = new FontLoader();
33+
const loader = new FontLoader()
3434

35-
const font = loader.parse(fontJson);
36-
const geometry = new TextGeometry("Code: mz\nCode: rjuho\nCode: ileska", {
37-
font: font,
35+
const font = loader.parse(fontJson)
36+
const geometry = new TextGeometry('Code: mz\nCode: rjuho\nCode: ileska', {
37+
font,
3838
size: 3,
3939
height: 0.5,
4040
curveSegments: 0.00001,
4141
bevelEnabled: true,
4242
bevelSize: 0.1,
43-
bevelThickness: 0.1,
44-
});
43+
bevelThickness: 0.1
44+
})
4545

46+
const material = new THREE.MeshPhongMaterial({ color: 0x888888 })
47+
const mesh = new THREE.Mesh(geometry, material)
48+
mesh.position.x = -5
49+
mesh.position.y = 5
4650

47-
const material = new THREE.MeshPhongMaterial({ color: 0x888888 });
48-
const mesh = new THREE.Mesh(geometry, material);
49-
mesh.position.x = -5;
50-
mesh.position.y = 5;
51+
this.scene.add(mesh)
5152

52-
this.scene.add(mesh);
53-
54-
this.scene.add(new THREE.HemisphereLight(0xbbbbbb, 0x777777, 20));
53+
this.scene.add(new THREE.HemisphereLight(0xbbbbbb, 0x777777, 20))
5554
}
5655

57-
get getCamera() {
58-
return this.camera;
56+
get getCamera () {
57+
return this.camera
5958
}
6059

61-
get getScene() {
62-
return this.scene;
60+
get getScene () {
61+
return this.scene
6362
}
6463

65-
get getEffectShaders() {
66-
return [shader];
64+
get getEffectShaders () {
65+
return [shader]
6766
}
6867

69-
animate() {
70-
shader.uniforms["sIntensity"].value = Math.sin(Date.now() / 50)
68+
animate () {
69+
shader.uniforms.sIntensity.value = Math.sin(Date.now() / 50)
7170

7271
if (upDir) {
73-
shader.uniforms["sCount"].value += 0.1;
72+
shader.uniforms.sCount.value += 0.1
7473
} else {
75-
shader.uniforms["sCount"].value -= 0.5;
74+
shader.uniforms.sCount.value -= 0.5
7675
}
7776

78-
if (shader.uniforms["sCount"].value < 10) {
77+
if (shader.uniforms.sCount.value < 10) {
7978
upDir = true
8079
}
8180

82-
if (shader.uniforms["sCount"].value > 100) {
81+
if (shader.uniforms.sCount.value > 100) {
8382
upDir = false
8483
}
85-
8684
}
8785
}
8886

89-
export { Credits };
87+
export { Credits }

scenes/generateCity.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function makeHouse (position, facing, params, scene) {
105105
}
106106

107107
function createLight (position, params, scene) {
108-
const spotLight = new THREE.SpotLight(0xff00ff)
108+
const spotLight = new THREE.SpotLight(0xffffff)
109109
spotLight.position.x = position[0]
110110
spotLight.position.y = position[1]
111111
spotLight.position.z = position[2]

0 commit comments

Comments
 (0)