source/Plx.js
function colorParallax(scrollPosition, start, duration, startValue, endValue, easing) {
  let startObject = null;
  let endObject = null;

  if (startValue[0].toLowerCase() === 'r') {
    startObject = rgbToObject(startValue);
  } else {
    startObject = hexToObject(startValue);
  }

  if (endValue[0].toLowerCase() === 'r') {
    endObject = rgbToObject(endValue);
  } else {
    endObject = hexToObject(endValue);
  }

  if (startObject && endObject) {
    const r = parallax(scrollPosition, start, duration, startObject.r, endObject.r, easing);
    const g = parallax(scrollPosition, start, duration, startObject.g, endObject.g, easing);
    const b = parallax(scrollPosition, start, duration, startObject.b, endObject.b, easing);
    const a = parallax(scrollPosition, start, duration, startObject.a, endObject.a, easing);

    return `rgba(${ parseInt(r, 10) }, ${ parseInt(g, 10) }, ${ parseInt(b, 10) }, ${ a })`;
  }

  return null;
}
function colorParallax(scrollPosition, start, duration, startValue, endValue, easing) {
  let startObject = null;
  let endObject = null;

  if (startValue[0].toLowerCase() === 'r') {
    startObject = rgbToObject(startValue);
  } else {
    startObject = hexToObject(startValue);
  }

  if (endValue[0].toLowerCase() === 'r') {
    endObject = rgbToObject(endValue);
  } else {
    endObject = hexToObject(endValue);
  }

  if (startObject && endObject) {
    const r = parallax(scrollPosition, start, duration, startObject.r, endObject.r, easing);
    const g = parallax(scrollPosition, start, duration, startObject.g, endObject.g, easing);
    const b = parallax(scrollPosition, start, duration, startObject.b, endObject.b, easing);
    const a = parallax(scrollPosition, start, duration, startObject.a, endObject.a, easing);

    return `rgba(${ parseInt(r, 10) }, ${ parseInt(g, 10) }, ${ parseInt(b, 10) }, ${ a })`;
  }

  return null;
}
function colorParallax ( scrollPosition , start , duration , startValue , endValue , easing ) { let startObject = null ; let endObject = null ; if ( startValue [ 0 ] . toLowerCase ( ) === 'r' ) { startObject = rgbToObject ( startValue ) ; } else { startObject = hexToObject ( startValue ) ; } if ( endValue [ 0 ] . toLowerCase ( ) === 'r' ) { endObject = rgbToObject ( endValue ) ; } else { endObject = hexToObject ( endValue ) ; } if ( startObject && endObject ) { const r = parallax ( scrollPosition , start , duration , startObject . r , endObject . r , easing ) ; const g = parallax ( scrollPosition , start , duration , startObject . g , endObject . g , easing ) ; const b = parallax ( scrollPosition , start , duration , startObject . b , endObject . b , easing ) ; const a = parallax ( scrollPosition , start , duration , startObject . a , endObject . a , easing ) ; return ` ${ parseInt ( r , 10 ) } ${ parseInt ( g , 10 ) } ${ parseInt ( b , 10 ) } ${ a } ` ; } return null ; }
Calculates current value for color parallax
Calculates current value for color parallax