smooth-gradient
Advanced tools
Comparing version 2.2.4 to 2.3.0
@@ -62,12 +62,3 @@ const NB_COLORS = 4; | ||
document.getElementById('gradients').addEventListener("mousemove", (event) => { | ||
const { x } = event; | ||
const { width } = document.getElementById('gradients').getBoundingClientRect(); | ||
const position = x - document.getElementById('gradients').getBoundingClientRect().x; | ||
const value = Math.floor(position * 100 / width); | ||
if (value < 0) value = 0; | ||
if (value > 100) value = 100; | ||
const updateFrame = (value) => { | ||
document.getElementById('selector').style.left = `${value - 1}%`; | ||
@@ -86,2 +77,17 @@ const color = gradient.getColorFromValue(value, 'rgb'); | ||
//document.getElementById('gradients').style.border = `4px solid ${color}`; | ||
} | ||
updateFrame(randomValue(20, 80)); | ||
document.getElementById('gradients').addEventListener("mousemove", (event) => { | ||
const { x } = event; | ||
const { width } = document.getElementById('gradients').getBoundingClientRect(); | ||
const position = x - document.getElementById('gradients').getBoundingClientRect().x; | ||
const value = Math.floor(position * 100 / width); | ||
if (value < 0) value = 0; | ||
if (value > 100) value = 100; | ||
updateFrame(value); | ||
}); |
{ | ||
"name": "smooth-gradient", | ||
"version": "2.2.4", | ||
"version": "2.3.0", | ||
"description": "Generates a gradient and can return a calculated color from an input", | ||
@@ -28,3 +28,3 @@ "type": "module", | ||
"url": "git+git@github.com:jussetain/color-gradient.git", | ||
"web": "https://github.com/jussetain/color-gradient/" | ||
"web": "https://jussetain.github.io/color-gradient/" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
13218
312