xxxxxxxxxx
45
//This sketch was created as an educational tool
//It is part of the 3D Text workshop, taught in P5js + WEBGL
//Made by Hannah Tardie
let x = 5;
let y = 10;
let z = 7;
let speedx = 1;
let speedy = 4;
let speedz = 2;
function setup() {
createCanvas(300, 300, WEBGL);
}
function draw() {
background(255, 255, 224);
// rotateX(frameCount * 0.005);
// rotateY(frameCount * 0.005);
// rotateZ(frameCount * 0.005);
x = x + speedx;
y = y + speedy;
z = z + speedz;
if ((x >= 500) || (x <= 0)) {
speedx = speedx * -1
}
if ((y >= 500) || y <= 0) {
speedy = speedy * -1
}
if ((z >= 700) || z <= 0) {
speedz = speedz * -1
}
let words = "words";
//translate(x, y);
let texts = createGraphics(100, 100);
noStroke();
texts.text(words, 10, 50);
texture(texts);
box(x, y, z);
}