記録

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

2回目のp5.js

2回目のp5.jsの授業が終わったので、勉強内容を含めて遊んだ本日のコードです。

function setup() {
  createCanvas(300, 300); //width,height
    colorMode(HSB,360,100,100);
    
}

function draw() {
    noStroke();
    fill(random(360),random(0,50),random(50,100));
    ellipse(mouseX,mouseY,mouseX%50,mouseY%50);
}

function mousePressed(){
 background(0,0,100);
}
function setup() {
  createCanvas(300, 300); //width,height
    colorMode(HSB,360,100,100,100);
}

function draw() {
    noStroke();
    fill((180+frameCount)%360,100,100,1);
    ellipse(mouseX,mouseY,50,50); //x,y,r,r
}

あと全然関係ない授業前に遊んでたProcessing

void setup() {
  size(500, 500);
  colorMode(HSB, 360, 100, 100);
  background(0, 0, 0);
}

void draw() {
  noStroke();
  fill(0, 0, 0, 10);
  rect(0, 0, width, height);
  stroke(frameCount%360, 100, 100);
  noFill();
  rect(50, 50, width-100, height-100);
  beginShape();
  for (int i=0; i<=5; i=i+1) {
    vertex(random(50, width-50), random(50, height-50));
  }
  endShape();
}

このあとブログでみんながコードをブログに載せられるように、それ用のブログ記事書きます。