API Reference
Waypoint

<Waypoint>

Waypoint allows to determine a point in a timeline in which to trigger a tween or function.

Render Props

PropTypeDetailsDefault
atnumberScrolled percentage of timeline at which the waypoint is triggered-
childrenReact.ReactNodeOptional: children to animate-
tweenSimpleTween & { target?: TweenTarget }Optional: tween config and target, applied when the waypoint is triggered-
onCall(() => void) | undefinedOptional: called when the waypoint is triggered-
onReverseCall(() => void) | undefinedOptional: called when the waypoint is triggered on reverse-
labelstring | undefinedOptional: label for the waypoint-
disabledboolean | undefinedOptional: whether the waypoint is disabledfalse

Usage

import * as Scrollytelling from "@bsmnt/scrollytelling";
 
export const HomePage = () => (
  <Scrollytelling.Root>
    <div id="fun-div">
      <Scrollytelling.Waypoint at={50} onCall={triggerConfetti} />
      <Scrollytelling.Waypoint
        at={75}
        tween={{
          target: ["#fun-div"],
          to: { background: "black", color: "white" },
          duration: 0.35,
        }}
      />
    </div>
  </Scrollytelling.Root>
);