@kayelaa/canvas API - v0.2.15
    Preparing search index...

    Class Substepper

    A utility class for sub-stepping a simulation or game logic at a fixed interval.

    Index

    Constructors

    • Creates a new Substepper instance.

      Parameters

      • Optionalinterval: number = Substepper.defaultInterval

        The fixed interval in milliseconds between sub-steps.

      • Optionalhandler: (self: Substepper, callIndex: number) => void

        The handler function to be called at each sub-step.

          • (self: Substepper, callIndex: number): void
          • Handler function to be called at each sub-step. Not read-only.

            Parameters

            • self: Substepper

              The Substepper instance.

            • callIndex: number

              The index of the current sub-step call.

            Returns void

      Returns Substepper

    Properties

    defaultInterval: number = ...
    handler: (self: Substepper, callIndex: number) => void

    Handler function to be called at each sub-step. Not read-only.

    Type Declaration

      • (self: Substepper, callIndex: number): void
      • Parameters

        • self: Substepper

          The Substepper instance.

        • callIndex: number

          The index of the current sub-step call.

        Returns void

    interval: number

    The fixed interval in milliseconds between sub-steps. Not read-only.

    accumulated: number

    Accumulated time in milliseconds since the last sub-step. Avoid modifying manually.

    Methods

    • Updates the sub-stepper with the given delta time.

      Parameters

      • delta: number

        The time in seconds since the last update.

      Returns void