xxxxxxxxxx
63
let pgs;
let res = [];
let pattern = [
"#2D4059","#EA5455","#F07B3F","#FFD460"
];
function setup() {
createCanvas(500, 500);
background(22);
angleMode(DEGREES);
push();
pgs = test(3);
for(let i =0;i<pgs.length;i++){
pgs[i].circle(pgs[i].width/2,pgs[i].height/2,40);
image(pgs[i],res[i].x,res[i].y);
}
pop();
}
keyPressed = () => {
if (key === 's') {
saveCanvas(canvas, 'canvas', 'png');
}
};
// 分割/座標保存/番号振り分け(関数実行用)
function test(s) {
let x,y;
if(width < height){
x = width/s;
y = x;
}else{
x = height/s;
y = x;
}
const pgs = [];
for(let i = 0; i<s; i++){
for(let j = 0; j<s; j++){
//pg.rect(x*i,y*j,x,x);
const pg = createGraphics(x,x);
pg.background(220);
pg.stroke(20);
pg.strokeWeight(3);
pgs.push(pg);
res.push(createVector(x*i,y*j));
//番号振り分け用
// TODO関数用に書く
}
}
return pgs;
}
// 縞模様
function stripe(){
//
}