diff --git a/static/js/background_anim.js b/static/js/background_anim.js index 1d06adfb8623dc9127f65674138246c197515a7f..f835fdb857424efa2ac3f4f175dc897f7b74e518 100644 --- a/static/js/background_anim.js +++ b/static/js/background_anim.js @@ -17,6 +17,8 @@ const LINE_COLOUR = "#777"; const VELOCITY_SLOWDOWN_MULTIPLIER = 0.998; const VELOCITY_PUSH_MULTIPLIER = 1.8; +const SHOW_VELOCITIES = true; + // ---- // Sort-of constants (change with window size) @@ -188,6 +190,15 @@ const drawConnectingLines = () => { ctx.closePath(); }; +const drawDebugText = () => { + for(let dot of dots) { + ctx.beginPath(); + ctx.font = "15px Arial"; + ctx.fillText(`${dot.vx}/${dot.vy}`,dot.x,dot.y); + ctx.closePath(); + } +}; + const draw = () => { // Clear the screen ctx.clearRect(0, 0, canvas.width, canvas.height); @@ -201,6 +212,11 @@ const draw = () => { // Draw connecting lines drawConnectingLines(); + + // Draw velocity text + if(SHOW_VELOCITIES) { + drawDebugText(); + } }; const physics = () => {