xxxxxxxxxx
let content = "You can change the\nbrightness of the background by moving your mouse from\nleft (black) to right (white).\n\n By moving your mouse up\nand down you change the\nnumber of objects and the\naperture.\n\n As long as you press your\nmouse you can change the\nrectangle to an ellipse.\n\n By pressing the button S\non your keyboard you can save the actuall frame of your\ncanvas in your downloads.\n\n Have Fun!\nMoritz ";
// Umbrüche sind als \n (break) im Text zu deklarieren
let sora;
// Font laden
function preload() {
sora = loadFont('Sora-SemiBold.ttf');
}
function setup() {
createCanvas(1920, 1080);
textFont(sora); // Font setzen
}
function draw() {
background(mouseX*0.14);
// Euer Code
//background(mouseY/10); //hintergrundfarbe ändert sich von dunkel zu hell
rectMode(CENTER);
//mouseX/1000
//let num = map(mouseY*3, 0, width, 0, 200);
//let num = map(sin(millis()/1000), -1, 1, 10, 200);
let num = map( mouseY*2, 0, width, 0, 200);
for (let y = 0; y < num; y += 0.25) {//mouseX*0.01
//let rot = map(y, 0, num, 0, PI*8);
let posx = map(y, 0, num, 0, height);
//let col = map(0,y, 0, num, y*10);
//stroke(col);
push();
translate(width/2, posx-width*0.25);
//rotate(rot);
rotate(sin( millis()/1000));
noFill();
stroke(255,20,10);
if (mouseIsPressed){
ellipse(0, 0, 20+6*y, 400+6*y);
}
else{
rect(0, 0, 100+6*y, 100+6*y); // Verändern des Multiplikators lässt die Öffnung größer und kleiner werden
}
//arc(0, 0, 150, 150, 0, PI);
//line(0, 0, 100, 0);
pop();
}
// Wort
textSize(250);
textAlign(CENTER, CENTER);
fill(255);
//noStroke();
text("live", width/2, height/2);
// Hilfe Text
fill(255,20,10);
textSize(32);
text("?", 15, 20);
if (mouseX > 0 && mouseX < 30 && mouseY > 0 && mouseY < 30) {
cursor(HAND);
text(content, 300, 420, 500, height);
//text(content, 20, 40, width-20, height-20);
}
else {
cursor(ARROW);
}
}
// Bild speichern
function keyPressed() {
if (key == "s") {
save('tool_grafik.png');
}
}