@rendley/sdk - v1.15.5
    Preparing search index...

    Class ClipStyle<T>

    Stores transform, crop, sizing, and masking state for a clip sprite.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Releases any style-owned runtime mask resources.

      Returns void

      Nothing.

    • Scales the clip to fit or cover the display area.

      Parameters

      • fitStyle: FitToScreenEnum

        Strategy used to size the clip against the display.

      • center: boolean = true

        When true, centers the clip before fitting; otherwise fits relative to its current position.

      • margin: number = 0

        Extra margin, in pixels, to include in the fit calculation.

      Returns void

      Nothing.

    • Returns number

    • Returns number

    • Returns runtime-only crop values applied by animation.

      Returns [number, number, number, number]

      The animated crop values in [left, top, right, bottom] order.

    • Returns [number, number]

    • Returns [number, number]

    • Returns number

    • Returns the runtime animation scale multipliers.

      Returns [number, number]

      The [x, y] animation scale multiplier pair.

    • Returns [number, number]

    • Returns the owning clip ID.

      Returns string

      The owning clip ID.

    • Returns the configured corner radii.

      Returns number[]

      The corner radii in top-left, top-right, bottom-right, bottom-left order.

    • Indicates whether corner radii are stored in relative mode.

      Returns boolean

      true if relative corner radii are enabled; otherwise false.

    • Returns the current crop values of the clip. The returned array contains four numbers: [left, top, right, bottom]

      Returns number[]

      The current crop values of the clip.

    • Returns [number, number]

    • Returns number

    • Returns [number, number]

    • Returns number

    • Returns [number, number]

    • Returns number

    • Returns number

    • Returns the base clip scale multipliers.

      Returns [number, number]

      The [x, y] scale pair.

    • Returns [number, number]

    • Returns number

    • Returns number

    • Returns [number, number]

    • Clears cached derived values so the next update fully recomputes style-dependent sprite state.

      Returns void

      Nothing.

    • Attaches a sprite instance to the style and applies the current style state to it.

      Parameters

      • sprite: T

        Sprite to control.

      Returns void

      Nothing.

    • Moves the clip to the center of the display.

      Returns void

      Nothing.

    • Rebinds the style to a different media asset ID.

      Parameters

      • mediaDataId: string

        Media asset ID associated with the clip.

      Returns void

      Nothing.

    • Scales the clip down uniformly so it fits inside the display while preserving aspect ratio.

      Returns void

      Nothing.

    • Serializes the clip style into a project-safe payload.

      Returns {
          alpha: number;
          clipId: string;
          cornerRadius?: [number, number, number, number];
          crop: [number, number, number, number];
          cropOffset: [number, number];
          height?: number;
          mediaDataId?: string;
          position: [number, number];
          relativeCornerRadius: boolean;
          rotation: number;
          scale: [number, number];
          width?: number;
          zIndex: number;
          zoom: [number, number];
      }

      The serialized style payload.

    • Parameters

      • alpha: number

      Returns void

    • Parameters

      • alpha: number

      Returns void

    • Sets runtime-only crop values applied by animation.

      Parameters

      • left: number

        Animated crop from the left edge.

      • top: number

        Animated crop from the top edge.

      • right: number

        Animated crop from the right edge.

      • bottom: number

        Animated crop from the bottom edge.

      Returns void

      Nothing.

    • Sets runtime-only crop offset values applied by animation.

      Parameters

      • x: number

        Horizontal crop offset in pixels.

      • y: number

        Vertical crop offset in pixels.

      Returns void

      Nothing.

    • Parameters

      • x: number
      • y: number

      Returns void

    • Parameters

      • rotation: number

      Returns void

    • Sets runtime-only scale multipliers applied by clip animation.

      Parameters

      • multiplierX: number

        Animated horizontal scale multiplier.

      • multiplierY: number

        Animated vertical scale multiplier.

      Returns void

      Nothing.

    • Sets runtime-only zoom multipliers applied by animation.

      Parameters

      • x: number

        Horizontal zoom multiplier.

      • y: number

        Vertical zoom multiplier.

      Returns void

      Nothing.

    • Updates the owning clip ID tracked by the style.

      Parameters

      • clipId: string

        Owning clip ID.

      Returns void

      Nothing.

    • Sets corner radii used to mask the clip into a rounded rectangle.

      Parameters

      • radii: number | [number, number, number, number]

        Uniform radius or individual radii for each corner.

      • relative: boolean = false

        When true, corner radii are interpreted relative to the unclipped sprite size.

      Returns void

      Nothing.

    • Sets the crop values for the clip's sprite. This will clip the original texture to the given coordinates. If the sprite is not a video, gif or image, it will not be updated. If the sprite has no texture, or the texture is not valid, it will not be updated. If updatePosition is true, it will also update the position of the sprite, so that the cropped area will maintain it's visual position.

      Parameters

      • left: number

        The left coordinate of the crop area

      • top: number

        The top coordinate of the crop area

      • right: number

        The right coordinate of the crop area

      • bottom: number

        The bottom coordinate of the crop area

      • updatePosition: boolean = true

        If true, it will also update the position of the sprite, so that the middle of the cropped area is at the same position as the middle of the original texture. Default is true.

      Returns void

    • Sets the base crop offset used when computing crop bounds.

      Parameters

      • x: number

        Horizontal crop offset in pixels.

      • y: number

        Vertical crop offset in pixels.

      Returns void

      Nothing.

    • Parameters

      • height: number

      Returns void

    • Parameters

      • x: number
      • y: number

      Returns void

    • Parameters

      • rotation: number

      Returns void

    • Sets the clip scale multipliers.

      Parameters

      • scaleX: number

        Horizontal scale multiplier.

      • scaleY: number

        Vertical scale multiplier.

      Returns void

      Nothing.

    • Parameters

      • width: number
      • height: number

      Returns void

    • Parameters

      • width: number

      Returns void

    • Parameters

      • zIndex: number

      Returns void

    • Sets the base zoom multipliers used when computing crop bounds.

      Parameters

      • zoomX: number

        Horizontal zoom multiplier.

      • zoomY: number

        Vertical zoom multiplier.

      Returns void

      Nothing.

    • Applies the current style state to a sprite, including transforms, crop, and mask updates.

      Parameters

      • sprite: T

        Sprite to update.

      Returns void

      Nothing.

    • Creates a clip style instance from serialized data.

      Parameters

      • payload: object

        Serialized style payload.

      Returns ClipStyle<Sprite>

      The deserialized clip style.