xxxxxxxxxx
51
//https://github.com/aferriss/p5jsShaderExamples
let myShader;
let myFont;
function preload() {
myShader = loadShader("shader.vert", "shader.frag");
myFont = loadFont('Kobata-Regular.otf');
}
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
textAlign(CENTER, CENTER);
noStroke();
}
function draw() {
background(0);
shader(myShader);
// Send the frameCount to the shader
myShader.setUniform("uFrameCount", frameCount);
push();
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.008);
sphere(width / 2.3, 200, 200);
pop();
if (mouseIsPressed) {
textFont(myFont);
textSize(70);
fill('#63686e');
text('INTERFACES', 0, 190);
} else {
textFont(myFont);
textSize(107);
fill('#63686e');
text('MOBILE', 0, -200);
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}