How to use the d3-color.interpolateHsl function in d3-color

To help you get started, we’ve selected a few d3-color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexaworld / hexaworld / entity / ring.js View on Github external
this.notches.forEach(function (notch, i) {
    if (colors[i] === 'rgb(55,55,55)') {
      if (Math.random() > 0.5) {
        notch.props.fill = 'rgb(230,230,230)'
      } else {
        notch.props.fill = 'rgb(130,130,130)'
      }
    } else {
      if (Math.random() > 0.5) {
        notch.props.fill = color.interpolateHsl(colors[i], 'rgb(230,230,230)')(0.2)
      } else {
        notch.props.fill = color.interpolateHsl(colors[i], 'rgb(130,130,130)')(0.2)
      }
    }
  })
}
github hexaworld / hexaworld / entity / ring.js View on Github external
var angle = Math.atan2(-diff.translation[1], -diff.translation[0]) * 180 / Math.PI

    if (angle < 0) angle += 360
    angle = angle - 90
    if (angle < 0) angle += 360

    var offset = -origin.rotation % 360
    if (offset < 0) offset += 360
    offset = 360 - offset
    if (offset === 360) offset = 0

    angle -= offset
    if (angle < 0) angle += 360
    if (radius < 0.01) angle = 0

    var fill = color.interpolateHsl('rgb(55,55,55)', target.color)(0.85)

    return { angle: angle, radius: radius, fill: fill }
  })
}
github hexaworld / hexaworld / entity / ring.js View on Github external
this.notches.forEach(function (notch, i) {
    if (colors[i] === 'rgb(55,55,55)') {
      if (Math.random() > 0.5) {
        notch.props.fill = 'rgb(230,230,230)'
      } else {
        notch.props.fill = 'rgb(130,130,130)'
      }
    } else {
      if (Math.random() > 0.5) {
        notch.props.fill = color.interpolateHsl(colors[i], 'rgb(230,230,230)')(0.2)
      } else {
        notch.props.fill = color.interpolateHsl(colors[i], 'rgb(130,130,130)')(0.2)
      }
    }
  })
}

d3-color

Color spaces! RGB, HSL, Cubehelix, Lab and HCL (Lch).

ISC
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis