U can change the variable state in console bar

image.png

radians

convert degree to its value in radians

using it in sin function

pretty cool website

Experience the Social Codes art exhibition, curated by on Feral File

Daily Art

Interest use of loop

var Numbers = 10;
function setup() {
  createCanvas(400, 400);
  textSize(64);
  textAlign(CENTER);
}

function draw() {
  background(100, 100, 123);
  stroke("white");
  for (i = 0; i <= Numbers; i++) {
    line((width / Numbers) * i, 0, mouseX, mouseY);
    line((width / Numbers) * i, height, mouseX, mouseY);
  }

  text("🕷️", mouseX, mouseY + width / 20);
}

录屏2024-09-27 下午1.25.21.mov

image.png

Assignment:

image.png

Finally I use some strange way to handle this bug, and get a funny effect!

image.png

var flowerPosition = 2;
let d = 100;
let zNumber = 8;
var z = 1;
var v = 1;
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(255);
  for (v = 1; v <= zNumber; v++) {
    for (z = 1; z <= zNumber; z++) {
      littleFlower(
        (width / zNumber) * z * flowerPosition - d / 2,
        (height / zNumber) * v * flowerPosition - d / 2,
        6
      );
    }
  }
}

//x,y is the flower generate position,fNumber is the number of the tiny leaves number
function littleFlower(x, y, fNumber) {
  //seperate number to degree
  var degree = 360 / fNumber;

  ellipseMode(CENTER);
  strokeWeight(50);
  stroke(40 * v, 255 - 10 * z, (v + z) * 55, 250);
  fill(200, 30 * v, 200, 40);
  //big background
  ellipse(x, y, d);
  push();
  translate(x, y);
  //generate inside shapes

  for (var i = 0; i <= fNumber - 1; i++) {
    noStroke();

    ellipse(0, 0, 17);
    fill(20 * v + (250 - 10 * i), 20 + 30 * v, 50 * z, 50);
    rotate(radians(degree));
    ellipse(d / 5 - 10, d / 5 - 10, d / 2);
    console.log(degree);
  }
  pop();
}