Skip to content
Permalink
Browse files

Add YEAHBOI 3D text

  • Loading branch information
MattyRad committed Feb 15, 2020
1 parent 08d4ff2 commit d0b7200d2550d1177be61b8e7876951da585a89e
Showing with 35 additions and 0 deletions.
  1. +35 −0 public/scripts.js
@@ -83,6 +83,35 @@ function oscillateCamera() {
camera.lookAt( scene.position );
}

var yeahboi_text = null;
var yeahboi_text_position = -3;

var setupText = function () {
var loader = new THREE.FontLoader();

loader.load("https://s3-us-west-2.amazonaws.com/s.cdpn.io/254249/helvetiker_regular.typeface.json", function (font) {
var message = "YEAHBO";

var text_geometry = new THREE.TextGeometry(message, {
font: font,
size: 1,
height: 0.2,
curveSegments: 12
});

var text_material = new THREE.MeshBasicMaterial( { color: 0x444444, opacity: 0.8, transparent: true } )

text_geometry.center();

yeahboi_text = new THREE.Mesh(text_geometry, text_material);
yeahboi_text.position.x -= yeahboi_text_position;

scene.add(yeahboi_text);
});
};

setupText();

var animate = function () {
requestAnimationFrame( animate );

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

yeahboi_text_position -= 0.05;

if (yeahboi_text) {
yeahboi_text.position.x = yeahboi_text_position;
}

if (keyboard.pressed("space")) {
if (jumping && ! doublejumping && jump_distance < 0.07) {
jump_distance = 0.1;

0 comments on commit d0b7200

Please sign in to comment.
You can’t perform that action at this time.