JSPM

lerp-css-string

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q31533F
  • License MIT

interpolate values in a css string

Package Exports

  • lerp-css-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lerp-css-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lerp-css-string

stable

Interpolates the values between two CSS strings, returning a new string.

var lerp = require('lerp-css-string')

lerp('10px', '0px', 0.5)                     // -> '5px'
lerp('100%', '50%', 0.5)                     // -> '75%'
lerp('100px 25%', '50px 20%', 0.5)           // -> '75px 22.5%'
lerp('360, 50%, 25%', '200, 100%, 50%', 0.5) // -> '280 75% 37.5%'

Usage

NPM

lerp(str1, str2, alpha)

Lerps between str1 and str2 based on the given alpha (typically 0.0 to 1.0), returning a new string with interpolated values and their units. Numbers and units are expected to be tightly packed (e.g. 50px).

License

MIT, see LICENSE.md for details.