xxxxxxxxxx
97
/*
annapujadas@gmail.com
january 2023
*/
let myFont;
function preload() {
myFont = loadFont('me&tree-Regular.otf');
img = loadImage('TFG_logoP1.png');
}
var x = [];
var y = [];
var canvas;
let button;
let randCol;
function setup() {
myColors = [color(8,0,0), color(68, 69, 70), color(62,14,15), color(32,12,4), color(78, 64, 46), color(129, 121, 110), color(120, 41, 1), color(160, 89, 69), color(197, 97, 56), color(210, 117,65), color(248, 178, 132), color(164, 129, 93), color(196, 167, 127), color(222, 171, 110), color(220, 192, 178), color(236, 229, 210)];
canvas = createCanvas(windowWidth, windowHeight);
randCol=random(myColors.length);
randCol=floor(randCol);
bk= myColors[randCol];
background(bk);
button = createButton('new drawing');
button.position(100, 50);
button.size(100, 50);
button.size(100, 50);
button.style("font-size", "18px");
button.style('background-color', color(68, 69, 70));
button.style("font-family", "Myriad Pro");
button.style("color", color(236, 229, 210));
button.mousePressed(reload);
button = createButton('save');
button.position(250, 50);
button.size(100, 50);
button.style("font-size", "18px");
button.style('background-color', color(68, 69, 70));
button.style("font-family", "Myriad Pro");
button.style("color", color(236, 229, 210));
button.mousePressed(saveDrawing);
}
function draw() {
for (var i = 0; i < 20; i++) {
x[i] = random(0,width-200);
y[i] = random(0,height-200);
textFont(myFont);
textAlign(CENTER, CENTER);
randCol=random(myColors.length);
randCol=floor(randCol);
c = myColors[randCol];
c.setAlpha(random(0, 255));
strokeWeight(1);
stroke(c);
fill(c);
textSize(random(0,height));
text(char(124),x[i],y[i]);
}
noLoop();
image(img, 860, 2100, 150, 150);
textFont('Myriad pro');
textAlign(CENTER, CENTER);
textSize(30);
strokeWeight(1);
noStroke();
fill(255);
text("@tree___me", 930, 2300);
text("CC BY-NC / 2023", 930, 2350);
}
function saveDrawing() {
save(canvas, 'tree_me', 'png');
}
function reload() {
clear();
setup();
draw();
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}