From cc9486b13e028c5ed1ba65bfff30695b4fa48194 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Thu, 31 Jan 2019 20:14:52 +0300 Subject: fix custom colors --- dvd/dvd.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dvd/dvd.js b/dvd/dvd.js index d98666f..1e5c822 100644 --- a/dvd/dvd.js +++ b/dvd/dvd.js @@ -1,5 +1,5 @@ /* -DVD Screensaver JS v1.0.2 +DVD Screensaver JS v1.0.3 Copyright 2019 Yaroslav de la Peña Smirnov All rights reserved. @@ -48,10 +48,12 @@ function playDVD(options={}){ ]; try{ if(options["colors"].length > 0){ - colors = option["colors"]; + colors = options["colors"]; } } - catch(e){} + catch(e){ + console.log(e) + } var canvas = document.getElementById("dvd"); if(!canvas){ @@ -108,11 +110,9 @@ function playDVD(options={}){ else if(py == 0) direction[1] = 1; // Change the color randomly - if (colors.length > 1){ - ctx.restore(); - ctx.fillStyle = colors[randomRange(0, colors.length+1)]; - ctx.save(); - } + ctx.restore(); + ctx.fillStyle = colors[randomRange(0, colors.length+1)]; + ctx.save(); } function initDVD(){ -- cgit v1.2.3