xxxxxxxxxx
/*
Das Ziel dieses Auftrags ist der Umgang mit vielen Objekten. Dieses Ziel habe ich erfüllt.
Weiter haben Cedric und ich uns gegenseitig eine Challenge gemacht, wer mit der gleichen Idee
eine zum Ansehen und vom Code her schönere Lösung schafft.
Author: Yannis Bontempi
Date 30.11.2021
Attribution: Gesamter Code selber entwickelt
*/
let font;
let gravBalls = [];
let textPoints = [];
let particles = [];
let n = 0.5
let ball1;
let smallRad = 5;
let colourBounds;
let particlesGo = false;
function preload() {
font = loadFont('NotoSansJP-Regular.otf');
}
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB, 100);
background(0);
colourBounds = random(100);
sampleFactor = width/(width-1);
smallRad = width/(width-3);
textPoints = font.textToPoints('infcom', width/4, height/2, width/6);
for (let i = 0; i < textPoints.length; i++) {
gravBalls.push(new gravityBall(textPoints[i].x, textPoints[i].y));
}
ball1 = new ball();
}
function draw() {
background(0, 0, 0, 7);
for (let i = 0; i < gravBalls.length; i++) {
gravBalls[i].calc();
}
ball1.show();
if(particlesGo == true){
for(let i = 0; i<particles.length; i++){
particles[i].calc();
}
}
}
function mousePressed() {
ball1.pressed(mouseX, mouseY);
}
function mouseReleased() {
ball1.released(mouseX, mouseY);
}