added some formatting

This commit is contained in:
Jürg Hallenbarter
2026-04-13 07:07:35 +00:00
parent 3f9de9c266
commit 5259410d77
7 changed files with 40 additions and 40 deletions

View File

@@ -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() {
}

View File

@@ -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);
}

View File

@@ -3,7 +3,7 @@ var numberOfSquaresY = 4;
function setup() {
createCanvas(500, 500);
background(255,255,255);
background(255, 255, 255);
}

View File

@@ -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)
}
}

View File

@@ -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() {
}

View File

@@ -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() {
}

View File

@@ -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);