source/Plx.js
function applyProperty(scrollPosition, propertyData, startPosition, duration, style, easing) {
  const {
    startValue,
    endValue,
    property,
    unit,
  } = propertyData;

  // If property is one of the color properties
  // Use it's parallax method
  const isColor = COLOR_PROPERTIES.indexOf(property) > -1;
  const parallaxMethod = isColor ? colorParallax : parallax;

  // Get new CSS value
  const value = parallaxMethod(
    scrollPosition,
    startPosition,
    duration,
    startValue,
    endValue,
    easing
  );

  // Get transform function
  const transformMethod = TRANSFORM_MAP[property];
  const filterMethod = FILTER_MAP[property];
  const newStyle = style;

  if (transformMethod) {
    // Get CSS unit
    const propertyUnit = getUnit(property, unit);
    // Transforms, apply value to transform function
    newStyle.transform[property] = transformMethod(value, propertyUnit);
  } else if (filterMethod) {
    // Get CSS unit
    const propertyUnit = getUnit(property, unit);
    // Filters, apply value to filter function
    newStyle.filter[property] = filterMethod(value, propertyUnit);
  } else {
    // All other properties
    newStyle[property] = value;

    // Add unit if it is passed
    if (unit) {
      newStyle[property] += unit;
    }
  }

  return newStyle;
}
function applyProperty(scrollPosition, propertyData, startPosition, duration, style, easing) {
  const {
    startValue,
    endValue,
    property,
    unit,
  } = propertyData;

  // If property is one of the color properties
  // Use it's parallax method
  const isColor = COLOR_PROPERTIES.indexOf(property) > -1;
  const parallaxMethod = isColor ? colorParallax : parallax;

  // Get new CSS value
  const value = parallaxMethod(
    scrollPosition,
    startPosition,
    duration,
    startValue,
    endValue,
    easing
  );

  // Get transform function
  const transformMethod = TRANSFORM_MAP[property];
  const filterMethod = FILTER_MAP[property];
  const newStyle = style;

  if (transformMethod) {
    // Get CSS unit
    const propertyUnit = getUnit(property, unit);
    // Transforms, apply value to transform function
    newStyle.transform[property] = transformMethod(value, propertyUnit);
  } else if (filterMethod) {
    // Get CSS unit
    const propertyUnit = getUnit(property, unit);
    // Filters, apply value to filter function
    newStyle.filter[property] = filterMethod(value, propertyUnit);
  } else {
    // All other properties
    newStyle[property] = value;

    // Add unit if it is passed
    if (unit) {
      newStyle[property] += unit;
    }
  }

  return newStyle;
}
function applyProperty ( scrollPosition , propertyData , startPosition , duration , style , easing ) { const { startValue , endValue , property , unit , } = propertyData ; // If property is one of the color properties // Use it's parallax method const isColor = COLOR_PROPERTIES . indexOf ( property ) > - 1 ; const parallaxMethod = isColor ? colorParallax : parallax ; // Get new CSS value const value = parallaxMethod ( scrollPosition , startPosition , duration , startValue , endValue , easing ) ; // Get transform function const transformMethod = TRANSFORM_MAP [ property ] ; const filterMethod = FILTER_MAP [ property ] ; const newStyle = style ; if ( transformMethod ) { // Get CSS unit const propertyUnit = getUnit ( property , unit ) ; // Transforms, apply value to transform function newStyle . transform [ property ] = transformMethod ( value , propertyUnit ) ; } else if ( filterMethod ) { // Get CSS unit const propertyUnit = getUnit ( property , unit ) ; // Filters, apply value to filter function newStyle . filter [ property ] = filterMethod ( value , propertyUnit ) ; } else { // All other properties newStyle [ property ] = value ; // Add unit if it is passed if ( unit ) { newStyle [ property ] += unit ; } } return newStyle ; }
Applies property parallax to the style object
Applies property parallax to the style object