mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Add additional marketplace options on launch
This commit is contained in:
30
doc/marketplace-scripts/checkerboard-test/source.js
Normal file
30
doc/marketplace-scripts/checkerboard-test/source.js
Normal file
@@ -0,0 +1,30 @@
|
||||
function init() {}
|
||||
|
||||
function tick(context, state) {
|
||||
const { ctx, width, height, deltaMs } = context;
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
const speed = 0.02;
|
||||
const offset = ((state.offset || 0) + (deltaMs || 0) * speed) % 40;
|
||||
state.offset = offset;
|
||||
|
||||
const squareSize = 40;
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
for (let y = -squareSize; y < height + squareSize; y += squareSize) {
|
||||
for (let x = -squareSize; x < width + squareSize; x += squareSize) {
|
||||
const isDark = ((x + y) / squareSize) % 2 === 0;
|
||||
ctx.fillStyle = isDark ? "#101828" : "#e2e8f0";
|
||||
ctx.fillRect(x + offset, y + offset, squareSize, squareSize);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.strokeStyle = "#ef4444";
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(width / 2, 0);
|
||||
ctx.lineTo(width / 2, height);
|
||||
ctx.moveTo(0, height / 2);
|
||||
ctx.lineTo(width, height / 2);
|
||||
ctx.stroke();
|
||||
}
|
||||
Reference in New Issue
Block a user