Small World Engine API Reference - v0.78.00
    Preparing search index...

    Interface CameraEffect

    Interface for camera effects that can be applied to a camera. Effects modify the position and target of the camera over time, and may also drive rotation (pitch/yaw) or a post-processing screen flash.

    interface CameraEffect {
        flashColor: Color;
        flashIntensity: number;
        isFinished: boolean;
        offset: Vector3D;
        pitchOffset: number;
        targetOffset: Vector3D;
        type: string;
        yawOffset: number;
        merge?(other: CameraEffect): boolean;
        update(deltaTime: number): void;
    }

    Implemented by

    Index
    flashColor: Color

    Tint color for this effect's flash contribution.

    flashIntensity: number

    This effect's contribution to the post-processing screen flash, in [0, 1].

    isFinished: boolean

    Whether the effect has finished its duration and should be removed.

    offset: Vector3D

    The current position offset generated by this effect.

    pitchOffset: number

    Pitch (X-axis) rotation offset in radians, applied to the view direction.

    targetOffset: Vector3D

    The current target offset generated by this effect.

    type: string

    The unique type identifier of the effect.

    yawOffset: number

    Yaw (Y-axis) rotation offset in radians, applied to the view direction.

    • Attempts to merge an incoming same-type effect into this one instead of it being added as a separate, independently-decaying instance (e.g. re-triggering Shake accumulates trauma into the already-active instance instead of stacking).

      Parameters

      • other: CameraEffect

        The newly requested effect of the same type.

      Returns boolean

      true if other was absorbed into this effect (caller should discard other and not add it), false to add other as a new, independent effect.

    • Updates the effect state based on elapsed time.

      Parameters

      • deltaTime: number

        Time elapsed since the last frame in seconds.

      Returns void