Code: Select all
function preload() {
font = loadFont("Courier New.ttf");
}
function setup() {
createCanvas(700, 700, WEBGL);
textFont(font);
textSize(30);
textAlign(CENTER, CENTER);
frameRate(60);
//debugMode()
}
function graph() {
// graph axis
noFill();
stroke(2);
box(500, 500);
fill("black");
text("", 0, 250);
push();
rotateY(-HALF_PI);
text("", 0, 250);
pop();
push();
rotateZ(HALF_PI);
translate(0, -500);
text("", 0, 250);
pop();
}
function elements() {
let x = 100;
let y = 20;
let z = -100;
push();
translate(x, y, z);
noStroke();
fill("red");
sphere(5)
pop();
}
function draw() {
background("white");
orbitControl();
graph();
elements();
}