記録

勉強したことに関するのノート。見返して分かるようにしてます。

arcが回る

function setup() {
  createCanvas(400, 400);
  colorMode(HSB, 360, 100, 100, 100);
  angleMode(DEGREES);
  background(0, 0, 0);
  frameRate(10);
}

function draw() {
  fill(0, 0, 0, 100);
  rect(0, 0, width, height);
  
  push();
  translate(width / 2, height / 2);
  
  for (let i = 0; i < width; i = i + 20) {
    noFill();
    
    let i2 = map(i, 0, width, 0, 360);  
    let s1 = random(360);
    let s2 = random(360);

    strokeWeight(5);
    stroke(i2 % 360, 100, 100, 50);
    arc(0, 0, i, i, s1, s2);
    
    strokeWeight(1);
    stroke(i2 % 360, 100, 100, 100);
    arc(0, 0, i, i, s1, s2);
  }
  pop();
}

電光掲示板みたいな質感の出し方を教わったのとarcで遊びたくて作った。
割と想像したとおりに作れたのと、mapをずっと理解できたのに避けてたのでうまく行ってよかった。丸好きかもしれない。