Bitbybit Docs
    Preparing search index...

    Class Time

    Hooks into the frame loop of the scene: a function registered here runs once per rendered frame and receives the milliseconds elapsed since the previous frame, which is how animations and interactions that change over time are driven.

    Index

    Constructors

    Methods

    • Registers a function to run on every rendered frame, for animation; it receives the milliseconds elapsed since the previous frame, so movement can be scaled by it.

      The function stays registered until the scene is reset.

      Parameters

      • update: (timePassedMs: number) => void

        The function to call each frame with the milliseconds since the previous one

      Returns void

      let angle = 0;
      bitbybit.time.registerRenderFunction((timePassedMs) => {
      angle += timePassedMs * 0.001;
      mesh.rotation.y = angle;
      });