xxxxxxxxxx
141
let font;
let blocks;
let buffer;
function preload() {
font = loadFont("PragmaticaMedium.otf");
}
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
background(0);
//this is background sketch
textSize(10);
textFont(font);
//this is letter sketch
buffer = createGraphics(512, 512);
buffer.textFont(font);
buffer.background(0);
buffer.fill(255);
buffer.textSize(600);
let txt = "Y"
buffer.text(txt, 66, -72, buffer.width, height);
}
function draw() {
background(0);
//this is background sketch
push();
let cellX = 50;
let cellY = 50;
randomSeed(11);
push();
scale(tan(frameCount*0.005)*10);
translate(-width/8,-height/8);
for(let x=-0;x<10;x++) {
for(let y=-0;y<10;y++) {
let z = random(-500,500);
push();
translate(x*cellX,y*cellY,z);
rotateY((frameCount + x*y)*0.01);
text("BILLY",0,0)
pop();
}
}
pop();
pop();
//this is Letter Sketch
push();
scale(tan(frameCount*0.005)*1);
translate(-width/2,-height/2);
let px = 200;
let py = 200;
texture(buffer);
textureMode(NORMAL);
translate(windowWidth/2-300, windowHeight/2-300);
//top left plane
push();
translate(100+px/2,100+py/2);
rotateX(-tan(frameCount*0.01)*0.1);
rotateY(-tan(frameCount*0.01)*0.1);
scale(1-sin(frameCount*0.01)*0.1);
translate(-px/2,-py/2);
beginShape();
vertex(0, 0, 0, 0);
vertex(px, 0, 0.5, 0);
vertex(px, py, 0.5, 0.5);
vertex(0, py, 0, 0.5);
endShape();
pop();
//top right plane
push();
translate(300+px/2,100+py/2);
rotateX(tan(-frameCount*0.01)*0.1);
rotateY(tan(-frameCount*0.01)*0.1);
scale(1+sin(frameCount*0.01)*0.1);
translate(-px/2,-py/2);
beginShape();
vertex(0, 0, 0.5, 0);
vertex(px, 0, 1, 0);
vertex(px, py, 1, 0.5);
vertex(0, py, 0.5, 0.5);
endShape();
pop();
//bottom left plane
push();
translate(100+px/2, 300+py/2);
rotateX(tan(-frameCount*0.01)*0.1);
rotateY(tan(-frameCount*0.01)*0.1);
scale(1+sin(frameCount*0.01)*0.1);
translate(-px/2,-py/2);
beginShape();
vertex(0, 0, 0, 0.5);
vertex(px, 0, 0.5, 0.5);
vertex(px, py, 0.5, 1);
vertex(0, py, 0, 1);
endShape();
pop();
//bottom right plane
push();
translate(300+px/2, 300+py/2);
rotateX(-tan(frameCount*0.01)*0.1);
rotateY(-tan(frameCount*0.01)*0.1);
scale(1-sin(frameCount*0.01)*0.1);
translate(-px/2,-py/2);
beginShape();
vertex(0, 0, 0.5, 0.5);
vertex(px, 0, 1, 0.5);
vertex(px, py, 1, 1);
vertex(0, py, 0.5, 1);
endShape();
pop();
pop();
}