Draw terrain over traces
This commit is contained in:
1 parent
a0b2509f7e
commit
47e8b4b1ae
1 file changed
+3
-3
@@ -24,11 +24,11 @@ let trajectories = [];
|
|||||||
|
|
||||||
// Init layers
|
// Init layers
|
||||||
const sky = createSky(W, H);
|
const sky = createSky(W, H);
|
||||||
const terrain = createTerrain(W, H);
|
|
||||||
const traces = createCanvas(W, H);
|
const traces = createCanvas(W, H);
|
||||||
|
const terrain = createTerrain(W, H);
|
||||||
const foreground = createCanvas(W, H);
|
const foreground = createCanvas(W, H);
|
||||||
|
|
||||||
for (let c of [sky, terrain, traces, foreground]) {
|
for (let c of [sky, traces, terrain, foreground]) {
|
||||||
c.canvas.style.width = `${W * Z}px`;
|
c.canvas.style.width = `${W * Z}px`;
|
||||||
c.canvas.style.height = `${H * Z}px`;
|
c.canvas.style.height = `${H * Z}px`;
|
||||||
document.body.appendChild(c.canvas);
|
document.body.appendChild(c.canvas);
|
||||||
@@ -346,7 +346,7 @@ function drawPlayers() {
|
|||||||
function drawTrajectories() {
|
function drawTrajectories() {
|
||||||
traces.clearRect(0, 0, W, H);
|
traces.clearRect(0, 0, W, H);
|
||||||
for (let {x, y, c, a} of trajectories) {
|
for (let {x, y, c, a} of trajectories) {
|
||||||
traces.globalAlpha = a/255;
|
traces.globalAlpha = a / 255;
|
||||||
plot(traces, x, y, c);
|
plot(traces, x, y, c);
|
||||||
}
|
}
|
||||||
traces.globalAlpha = 1;
|
traces.globalAlpha = 1;
|
||||||
|
|||||||
Reference in new issue
Block a user