This commit is contained in:
赵鑫 2022-12-17 23:59:32 +08:00
parent 5c8e3ae20c
commit 91d471ea15
9 changed files with 17 additions and 14 deletions

View File

@ -21,7 +21,7 @@
function draw() { function draw() {
background(0); background(0);
drawGrid(32); drawGrid(255, 32);
textInfo("作品模板", "2022-12-12"); textInfo("作品模板", "2022-12-12");
} }
</script> </script>

View File

@ -19,7 +19,7 @@
function draw() { function draw() {
background(0); background(0);
drawGrid(32); drawGrid(255, 32);
单摆.draw(); 单摆.draw();
单摆.update(); 单摆.update();
textInfo("单摆", "2022-12-14"); textInfo("单摆", "2022-12-14");

View File

@ -46,7 +46,7 @@
function draw() { function draw() {
background(255); background(255);
drawGrid(32, 0); drawGrid(0);
let hx = width / 2; let hx = width / 2;
let hy = 100; let hy = 100;

View File

@ -30,7 +30,7 @@
function draw() { function draw() {
clear(); clear();
background(0); background(0);
drawGrid(32); drawGrid(255);
if ( if (
mouseIsPressed && mouseIsPressed &&

View File

@ -33,7 +33,7 @@
function draw() { function draw() {
background(0); background(0);
drawGrid(32); drawGrid(255);
for (let i = 0; i < plantsNumber; i++) { for (let i = 0; i < plantsNumber; i++) {
planets[i].update(); planets[i].update();

View File

@ -36,7 +36,7 @@
function draw() { function draw() {
clear(); clear();
background(64); background(0);
drawGrid(); drawGrid();
转盘.update(); 转盘.update();
转盘.draw(); 转盘.draw();
@ -67,8 +67,8 @@
draw() { draw() {
push(); push();
// 绘制盘面 // 绘制盘面
fill(0); fill(200);
stroke(200); stroke(128);
strokeWeight(2); strokeWeight(2);
translate(this.x, this.y); translate(this.x, this.y);
circle(0, 0, 500); circle(0, 0, 500);
@ -85,7 +85,7 @@
// 绘制文字 // 绘制文字
push(); push();
noStroke(); noStroke();
fill(200); fill(0);
if (i == Math.floor(this.hand.heading / 每一格的角度)) { if (i == Math.floor(this.hand.heading / 每一格的角度)) {
fill("red"); fill("red");
stroke("yellow"); stroke("yellow");

View File

@ -30,7 +30,7 @@
function draw() { function draw() {
background(0); background(0);
drawGrid(32); drawGrid(255);
playdemos([追逐鼠标, 小车追逐, 小车巡游, 小车巡线], 10); playdemos([追逐鼠标, 小车追逐, 小车巡游, 小车巡线], 10);
} }

View File

@ -16,7 +16,7 @@
function draw() { function draw() {
background(0); background(0);
drawGrid(32); drawGrid(255);
noFill(); noFill();
strokeWeight(2); strokeWeight(2);
stroke("lightgreen"); stroke("lightgreen");

View File

@ -5,11 +5,14 @@ function loadJavaScript(path) {
} }
function playdemos(list, delay = 10) { function playdemos(list, delay = 10) {
let n = Math.floor((frameCount / (delay * 60)) % list.length); let fps = frameRate();
list[n](); fps = 60;
let n = floor((frameCount / (delay * fps)) % list.length);
let func = list[n];
func();
} }
function drawGrid(fade = 64, color = 255) { function drawGrid(color = 255, fade = 32) {
push(); push();
colorMode(RGB); colorMode(RGB);
stroke(color, fade); stroke(color, fade);