From 062d249d00b6e019ded2b37265556b4cd923b001 Mon Sep 17 00:00:00 2001 From: koehr Date: Thu, 17 May 2018 01:51:05 +0200 Subject: [PATCH] smooth mountain light transition --- src/solar-quartet.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/solar-quartet.js b/src/solar-quartet.js index f360c12..695a12c 100644 --- a/src/solar-quartet.js +++ b/src/solar-quartet.js @@ -76,12 +76,11 @@ export default function drawFrame (canvas, ctx, width, height, grCanvas, grCtx, for(let i = 0; i < 4; i++) { // Set the main canvas fillStyle to a shade of green-brown with variable lightness // depending on sunY and depth - if (sunY > -25) { // night - ctx.fillStyle = `hsl(5, 23%, ${4-i}%)` - } else if (sunY < -70) { // day (TODO) + + if (sunY > -60) { + ctx.fillStyle = `hsl(5, 23%, ${33*emissionStrength - i*6*emissionStrength}%)` + } else { ctx.fillStyle = `hsl(${220 - i*40}, 23%, ${33-i*6}%)` - } else { // dawn / sunset - ctx.fillStyle = `hsl(7, 23%, ${23-i*6}%)` } // For each column in our canvas...