xxxxxxxxxx
let myFont;
let cells;
let offset, margin;
let d;
let longString = '天 が わ し を も う 五 年 間 だ け 生 か し て お い て く れ た ら 、 私 は 真 の 画 家 に な れ た だ ろ う に ';
// ここから引用:https://meigen.pt-hamamoto.biz/index.php?899
function preload() {
myFont = loadFont('PottaOne-Regular.ttf');
}
function setup() {
createCanvas(800, 800);
colorMode(HSB, 360, 100, 100);
angleMode(DEGREES);
background(0, 0, 80);
fill(0, 0, 35);
textFont(myFont);
textSize(60);
cells = 5; //int(random(3, 10));
offset = width / 20;
margin = 3; //offset / 5;
d = (width - offset * 2 - margin * (cells - 3)) / cells;
}
function draw() {
for (let j = 0; j < cells; j++) {
for (let i = 0; i < cells; i++) {
//各格子の左上の座標
let x = offset + i * (d + margin);
let y = offset + j * (d + margin);
//各格子ごとの中心
let cx = x + d * 0.3;
let cy = y + d * 0.8;
//位置座標(cx,cy)と時間経過(frameCount)を用いてノイズを生成
let n = noise(cx / 100, cy / 50, frameCount / 100);
let angle = n * 360;
push();
//格子の中心に原点を移動し,回転
translate(cx + 10, cy + 10);
rotate(angle);
noStroke();
// rect(-d / 2, 0, d / 2, 5, 3);
text(longString, -d / 2, 0, d / 2);
pop();
}
}
noLoop();
}
function mousePressed() {
loop();
}