35 lines
733 B
JavaScript
35 lines
733 B
JavaScript
function setup() {
|
|
createCanvas(600, 600);
|
|
angleMode(DEGREES);
|
|
pixelDensity(1);
|
|
colorMode(HSB);
|
|
cursor(CROSS);
|
|
frameRate(60);
|
|
}
|
|
|
|
function draw() {
|
|
background(0);
|
|
|
|
drawGrid();
|
|
textInfo();
|
|
}
|
|
|
|
function drawGrid() {
|
|
push();
|
|
stroke(255, 64);
|
|
strokeWeight(1);
|
|
for (let x = 0; x < width; x += 10) line(x, 0, x, height);
|
|
for (let y = 0; y < height; y += 10) line(0, y, width, y);
|
|
pop();
|
|
}
|
|
|
|
function textInfo(title, date, name = "赵海洋爸爸") {
|
|
push();
|
|
noStroke();
|
|
fill(255);
|
|
text(`作品:${title}`, 30, height - 70);
|
|
text(`作者:${name}`, 30, height - 50);
|
|
text(`日期:${date}`, 30, height - 30);
|
|
pop();
|
|
}
|