How to use the @popmotion/popcorn.applyOffset function in @popmotion/popcorn

To help you get started, we’ve selected a few @popmotion/popcorn 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 Popmotion / popmotion / packages / popmotion / src / input / pointer / index.ts View on Github external
export default ({ x, y, ...props }: PointerProps = {}): Action => {
  if (x !== undefined || y !== undefined) {
    const applyXOffset = applyOffset(x || 0);
    const applyYOffset = applyOffset(y || 0);
    const delta = { x: 0, y: 0 };

    return pointer(props).pipe((point: Point2D) => {
      delta.x = applyXOffset(point.x);
      delta.y = applyYOffset(point.y);
      return delta;
    });
  } else {
    return pointer(props);
  }
};
github Popmotion / popmotion / packages / popmotion / src / input / pointer / index.ts View on Github external
export default ({ x, y, ...props }: PointerProps = {}): Action => {
  if (x !== undefined || y !== undefined) {
    const applyXOffset = applyOffset(x || 0);
    const applyYOffset = applyOffset(y || 0);
    const delta = { x: 0, y: 0 };

    return pointer(props).pipe((point: Point2D) => {
      delta.x = applyXOffset(point.x);
      delta.y = applyYOffset(point.y);
      return delta;
    });
  } else {
    return pointer(props);
  }
};