From f53b2b5543d7c6009fdf9ccaccd017868ab29925 Mon Sep 17 00:00:00 2001 From: HxxxxxS <16c52527@opayq.com> Date: Mon, 6 May 2024 19:58:48 +0200 Subject: [PATCH] change to blendmode logic --- script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index 66ed0c7..97325aa 100644 --- a/script.js +++ b/script.js @@ -123,7 +123,7 @@ function handleVideoEnded(event) { function drawVideos() { ctx.clearRect(0, 0, canvas.width, canvas.height) - let blendModes = ["source-over","overlay","screen"] + let blendModes = ["screen","overlay","difference","lighten"] videos.forEach((video,i) => { // Calculate scaling factor to fit the canvas @@ -139,9 +139,9 @@ function drawVideos() { // Use default blend mode for first video (i=0), repeat the rest of blendModes if (i === 0) { - ctx.globalCompositeOperation = blendModes[0] + ctx.globalCompositeOperation = "source-over" } else { - ctx.globalCompositeOperation = blendModes[(i - 1) % (blendModes.length - 1) + 1] + ctx.globalCompositeOperation = blendModes[i % blendModes.length] } // Draw the current video frame onto the canvas