diff --git a/sketches/2images.js b/sketches/2images.js index 3dfc2db..dfe0f94 100644 --- a/sketches/2images.js +++ b/sketches/2images.js @@ -5,14 +5,14 @@ function preload() { function setup() { createCanvas(img1.width, img1.height); - background(255,255,255) + background(255, 255, 255) //image(img1, 0, 0); for (let col = 0; col < img1.width; col += 1) { for (let row = 0; row < img1.height; row += 1) { let c = img1.get(col, row); - if (col%2 == 0){ + if (col % 2 == 0) { stroke(color(c)); strokeWeight(1); point(col, row); @@ -22,7 +22,7 @@ function setup() { for (let col = 0; col < img2.width; col += 1) { for (let row = 0; row < img2.height; row += 1) { let c = img2.get(col, row); - if (col%2 == 1){ + if (col % 2 == 1) { stroke(color(c)); strokeWeight(1); point(col, row); @@ -36,6 +36,6 @@ function draw() { } -function mousePressed(){ +function mousePressed() { } \ No newline at end of file diff --git a/sketches/Cubes.js b/sketches/Cubes.js index 53fd42d..9c6de53 100644 --- a/sketches/Cubes.js +++ b/sketches/Cubes.js @@ -5,13 +5,13 @@ var mouseIndex = 0 function setup() { createCanvas(500, 500); - background(255,255,255) + background(255, 255, 255) noFill(); - for (i = 0; i < 30; i++){ - size = random(0, 15)*i; - randomX = random(-width/10, width/10); - randomY = random(-height/10, height/10); - square(width/2 +randomX - size/2, height/2 +randomY- size/2, size); + for (i = 0; i < 30; i++) { + size = random(0, 15) * i; + randomX = random(-width / 10, width / 10); + randomY = random(-height / 10, height / 10); + square(width / 2 + randomX - size / 2, height / 2 + randomY - size / 2, size); } } @@ -20,10 +20,10 @@ function draw() { } -function mousePressed(){ +function mousePressed() { mouseIndex++ - size = random(0, 15)*i; - randomX = random(-width/10, width/10); - randomY = random(-height/10, height/10); - square(width/2 +randomX - size/2, height/2 +randomY- size/2, size); + size = random(0, 15) * i; + randomX = random(-width / 10, width / 10); + randomY = random(-height / 10, height / 10); + square(width / 2 + randomX - size / 2, height / 2 + randomY - size / 2, size); } \ No newline at end of file diff --git a/sketches/RecursiveCubes.js b/sketches/RecursiveCubes.js index e8dce14..6347d71 100644 --- a/sketches/RecursiveCubes.js +++ b/sketches/RecursiveCubes.js @@ -3,7 +3,7 @@ var numberOfSquaresY = 4; function setup() { createCanvas(500, 500); - background(255,255,255); + background(255, 255, 255); } diff --git a/sketches/calmCircles.js b/sketches/calmCircles.js index 8ca5de0..87698f5 100644 --- a/sketches/calmCircles.js +++ b/sketches/calmCircles.js @@ -3,31 +3,31 @@ function setup() { } function draw() { - background(random(100,200), 0, random(100,200)); + background(random(100, 200), 0, random(100, 200)); - for (let i = 0; i <= width * sqrt(2); i += 10){ - stroke(random(255),random(255),random(255)) + for (let i = 0; i <= width * sqrt(2); i += 10) { + stroke(random(255), random(255), random(255)) strokeWeight(2) noFill() - circle(width/2 + random(0,30),height/2 + random(0,30),i) + circle(width / 2 + random(0, 30), height / 2 + random(0, 30), i) - const strokeValue = i%20 ? 100 : 0; + const strokeValue = i % 20 ? 100 : 0; stroke(strokeValue) } - for (let i = 0; i < 50; i++){ - stroke(random(255),random(255),random(255)) + for (let i = 0; i < 50; i++) { + stroke(random(255), random(255), random(255)) let x = random(0, width) let y = random(0, height) - line(width/2,height/2,x,y) + line(width / 2, height / 2, x, y) } } -function mousePressed(){ - for (let i = 0; i < 50; i++){ - stroke(random(255),random(255),random(255)) - let x = random(0, width) - let y = random(0, height) - line(mouseX,mouseY,x,y) - } +function mousePressed() { + for (let i = 0; i < 50; i++) { + stroke(random(255), random(255), random(255)) + let x = random(0, width) + let y = random(0, height) + line(mouseX, mouseY, x, y) + } } \ No newline at end of file diff --git a/sketches/image.js b/sketches/image.js index e767937..c4bdbb4 100644 --- a/sketches/image.js +++ b/sketches/image.js @@ -5,10 +5,10 @@ function preload() { function setup() { createCanvas(img1.width, img1.height); - background(255,255,255) + background(255, 255, 255) //image(img1, 0, 0); - var glithes= random(3, 10); + var glithes = random(3, 10); for (let col = 0; col < img1.width; col += 1) { for (let row = 0; row < img1.height; row += 1) { @@ -25,6 +25,6 @@ function draw() { } -function mousePressed(){ +function mousePressed() { } \ No newline at end of file diff --git a/sketches/imageNoice.js b/sketches/imageNoice.js index 28bdeca..4053957 100644 --- a/sketches/imageNoice.js +++ b/sketches/imageNoice.js @@ -4,7 +4,7 @@ function preload() { function setup() { createCanvas(img1.width, img1.height); - background(255,255,55) + background(255, 255, 55) //image(img1, 0, 0); @@ -12,11 +12,11 @@ function setup() { for (let row = 0; row < img1.height; row += 1) { let c = img1.get(col, row); - if (c[0] + c[1] + c[2] < random(0, 255)*3) { + if (c[0] + c[1] + c[2] < random(0, 255) * 3) { c[0] = 0; c[1] = 0; c[2] = 0; - }else{ + } else { c[0] = 255; c[1] = 255; c[2] = 255; @@ -33,6 +33,6 @@ function draw() { } -function mousePressed(){ +function mousePressed() { } \ No newline at end of file diff --git a/sketches/labyrinth.js b/sketches/labyrinth.js index d9d098c..1f56602 100644 --- a/sketches/labyrinth.js +++ b/sketches/labyrinth.js @@ -173,7 +173,7 @@ function applyCohesion(p, particleGrid, cellX, cellY) { if (other === p) continue; let ddx = other.x - p.x; let ddy = other.y - p.y; - let dist = sqrt(ddx*ddx + ddy*ddy); + let dist = sqrt(ddx * ddx + ddy * ddy); if (dist > 0 && dist < cohesionRadius) { let strength = cohesionStrength * (1 - dist / cohesionRadius); fx += ddx * strength; @@ -245,7 +245,7 @@ function draw() { if (p.y <= radius || p.y >= height - radius) p.vy *= -0.9; } - for (let i = waterParticles.length-1; i >= 0; i--) { + for (let i = waterParticles.length - 1; i >= 0; i--) { let p = waterParticles[i]; if (p.y + radius >= height) { waterParticles.splice(i, 1);