Skip to content

Commit d0b7200

Browse files
committed
Add YEAHBOI 3D text
1 parent 08d4ff2 commit d0b7200

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

public/scripts.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,35 @@ function oscillateCamera() {
8383
camera.lookAt( scene.position );
8484
}
8585

86+
var yeahboi_text = null;
87+
var yeahboi_text_position = -3;
88+
89+
var setupText = function () {
90+
var loader = new THREE.FontLoader();
91+
92+
loader.load("https://s3-us-west-2.amazonaws.com/s.cdpn.io/254249/helvetiker_regular.typeface.json", function (font) {
93+
var message = "YEAHBO";
94+
95+
var text_geometry = new THREE.TextGeometry(message, {
96+
font: font,
97+
size: 1,
98+
height: 0.2,
99+
curveSegments: 12
100+
});
101+
102+
var text_material = new THREE.MeshBasicMaterial( { color: 0x444444, opacity: 0.8, transparent: true } )
103+
104+
text_geometry.center();
105+
106+
yeahboi_text = new THREE.Mesh(text_geometry, text_material);
107+
yeahboi_text.position.x -= yeahboi_text_position;
108+
109+
scene.add(yeahboi_text);
110+
});
111+
};
112+
113+
setupText();
114+
86115
var animate = function () {
87116
requestAnimationFrame( animate );
88117

@@ -96,6 +125,12 @@ var animate = function () {
96125
}
97126
}
98127

128+
yeahboi_text_position -= 0.05;
129+
130+
if (yeahboi_text) {
131+
yeahboi_text.position.x = yeahboi_text_position;
132+
}
133+
99134
if (keyboard.pressed("space")) {
100135
if (jumping && ! doublejumping && jump_distance < 0.07) {
101136
jump_distance = 0.1;

0 commit comments

Comments
 (0)