diff --git a/hamburger.mjs b/hamburger.mjs index 18ed42a..7767172 100644 --- a/hamburger.mjs +++ b/hamburger.mjs @@ -241,14 +241,15 @@ export class HamburgerMorphing { const targetColor = isHovering ? this.options.hover : this.options.foreground; // Only change color for lines that have the foreground color (not background/cutout colors) + const hoverDuration = ANIMATION_DURATION / 2; // Half the morphing time if (this.line1.attr('stroke') === this.options.foreground || this.line1.attr('stroke') === this.options.hover) { - this.line1.animate(ANIMATION_DURATION, 0, "now").attr({ stroke: targetColor }); + this.line1.animate(hoverDuration, 0, "now").attr({ stroke: targetColor }); } if (this.line2.attr('stroke') === this.options.foreground || this.line2.attr('stroke') === this.options.hover) { - this.line2.animate(ANIMATION_DURATION, 0, "now").attr({ stroke: targetColor }); + this.line2.animate(hoverDuration, 0, "now").attr({ stroke: targetColor }); } if (this.line3.attr('stroke') === this.options.foreground || this.line3.attr('stroke') === this.options.hover) { - this.line3.animate(ANIMATION_DURATION, 0, "now").attr({ stroke: targetColor }); + this.line3.animate(hoverDuration, 0, "now").attr({ stroke: targetColor }); } }