xxxxxxxxxx
108
let x;
let y;
var word = ['innovative', 'useful', 'aesthetic', 'understandable', 'unobtrusive', 'honest', 'long-lasting', 'thorough', 'environmentally friendly', 'as little design as possible'];
let images = [];
let numImages = 10;
let bgcolors=[0,220,255];
let fontcolors=[255,0,0];
let numcolors=[[245, 168, 29],255,220];
//Generate random numbers, only integers
function getRandomInt(min,max) {
return Math.floor(Math.random() * (max-min+1)+min);
}
function preload() {
let image1 = loadImage('calculator.png');
let image2 = loadImage('camera.png');
let image3 = loadImage('chair.png');
let image4 = loadImage('coffeemaker.png');
let image5 = loadImage('monitor.png');
let image6 = loadImage('radio1.png');
let image7 = loadImage('radio2.png');
let image8 = loadImage('radio3.png');
let image9 = loadImage('record.png');
let image10 = loadImage('record2.png');
images = [image1,image2,image3,image4,image5,image6,image7,image8,image9,image10];
}
let BodoniModa;
let Jost;
function setup() {
createCanvas(720, 1000);
noLoop();
}
function draw() {
var colorscheme = getRandomInt(0,2);
background(bgcolors[colorscheme]);
//Add yellow rectangle
x = random (100, 800);
y = random (100, 800);
push();
fill(245, 168, 29);
noStroke();
rect(x, y, random(500));
pop();
//IMAGES ------------------------------------------------------
let randoImg = random(images);
let scale = random(.5, 1);
image(randoImg, 360 - scale*randoImg.width/2 + random(-100,100), 500 - scale*randoImg.height/2 + random(-100,100), scale*randoImg.width, scale*randoImg.height);
//Add red circle
x = random (100, 800);
y = random (100, 800);
push();
fill([183, 34, 40]);
noStroke();
ellipse(x, y, random(500));
pop();
//TYPE------------------------------------------------------
textSize(24);
fill(fontcolors[colorscheme]);
text('Good Design Is', 10, 40);
textSize(24);
text('– Dieter Rams', 560, 980);
var randomsecond = getRandomInt(1,10); //pick random number
var randomword = (word[randomsecond-1]);//use random number to select random word
//text(randomword, x, y);
textFont("BodoniModa",getRandomInt(50, 250));
textLeading(150);
textWrap(CHAR);
text(randomword, 15, getRandomInt(10, 550), 700);
//number(randomword, x, y);
textFont("Jost", getRandomInt(100, 450));
fill(numcolors[colorscheme]);
text(randomsecond, getRandomInt(-50, 400), getRandomInt(400, 1000));
}
function mousePressed() {
redraw();
}