Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layer

Hierarchy

  • Layer

Index

Constructors

constructor

Properties

Readonly active

active: boolean = true

Whether the video switch is enabled, and the current time is between in the inPoint and outPoint of the layer

Optional Readonly audioActive

audioActive: boolean = true

Whether the audio switch is enabled, and the current time is in between the inPoint and outPoint of the layer

Optional Readonly audioLevels

audioLevels: Property<Vector2D> = ...

The value of the Audio Levels property of the layer, in decibels. This value is a 2D value; the first value represents the left audio channel, and the second value represents the right. The value is not the amplitude of the audio track of the source material. Instead, it is the value of the Audio Levels property, which may be affected by keyframes.

Readonly colorDepth

colorDepth: number = 8

The project color depth value. For example, colorDepth returns 16 when the project color depth is 16 bits per channel.

Readonly enabled

enabled: boolean = true

Whether the video switch for the layer is enabled

Readonly hasAudio

hasAudio: boolean = true

Whether the layer has audio data

Readonly hasParent

hasParent: boolean = true

Whether the layer has a parent layer

Readonly hasVideo

hasVideo: boolean = true

Whether the layer has video data

Readonly height

height: number = 1080

The height of the layer in pixels, same as source.height

Readonly inPoint

inPoint: number = 0

The in point of the layer, in seconds

Readonly index

index: number = 0

The index number of the layer in the composition

Optional Readonly marker

marker: MarkerProperty = ...

The marker property group object

Optional Readonly materialOption

materialOption: MaterialOptions = ...

The material options property group object

Readonly name

name: string = "Layer name"

The name of the layer

Readonly outPoint

outPoint: number = 1

The out point of the layer in seconds

Optional Readonly parent

parent: Camera | Layer | Light = ...

The parent Layer object of the layer, if it has one

Optional Readonly source

source: Comp | Footage = ...

The source Comp or source Footage object for the layer. Default time is adjusted to the time in the source

Readonly startTime

startTime: number = 0

The start time of the layer in seconds

Optional Readonly text

text: Text = ...

The text property group object

Readonly time

time: number = 0

The composition time, in seconds, at which the expression is being evaluated.

Optional Readonly timeRemap

timeRemap: Property<number> = ...

The value of the Time Remap property, in seconds, if Time Remap is enabled.

Readonly transform

transform: Transform = ...

The transform property group object

Readonly width

width: number = 1920

The width of the layer in pixels, same as source.width

Methods

add

  • add<A, B>(a: A, b: B): MathReturn<A, B>

clamp

  • clamp<T>(value: T, limit1: number, limit2: number): T
  • Constrains a given number, or each element of an array, to fall within a a given range

    Type parameters

    • T: number | number[]

    Parameters

    • value: T

      Array or number to constrain

    • limit1: number

      Lower limit

    • limit2: number

      Upper limit

    Returns T

comp

  • comp(name: string): Comp
  • Retrieves a composition by name

    Parameters

    • name: string

      The name of the composition

    Returns Comp

    The composition with the given name

cross

degreesToRadians

  • degreesToRadians(degrees: number): number
  • Convert a given value in degrees to radians

    Parameters

    • degrees: number

      The value to convert

    Returns number

    The value radians

div

  • div<VectorType>(vec1: VectorType, amount: number): VectorType
  • Divides a vector by a given scalar amount

    Type parameters

    Parameters

    • vec1: VectorType

      The vector to divide

    • amount: number

      The amount to divide by

    Returns VectorType

dot

ease

  • ease(t: number, tMin: number, tMax: number, value1?: number | [], value2?: number | []): number | []
  • Parameters

    • t: number

      The input value to be re-mapped

    • tMin: number

      The inputs low floor

    • tMax: number

      The inputs high ceiling

    • Optional value1: number | []

      The output floor

    • Optional value2: number | []

      The output ceiling

    Returns number | []

    A given value, mapped from one range to another, clamped to the output range. The mapping will ease in and out so it reaches the output range with a velocity of 0. If only 3 parameters are given, the input range is 0 to 1 and the given values are used for the output range.

easeIn

  • easeIn(t: number, tMin: number, tMax: number, value1?: number | [], value2?: number | []): number | []
  • Parameters

    • t: number

      The input value to be re-mapped

    • tMin: number

      The inputs low floor

    • tMax: number

      The inputs high ceiling

    • Optional value1: number | []

      The output floor

    • Optional value2: number | []

      The output ceiling

    Returns number | []

    A given value, mapped from one range to another, clamped to the output range. The mapping will ease out with a velocity of 0. If only 3 parameters are given, the input range is 0 to 1 and the given values are used for the output range.

easeOut

  • easeOut(t: number, tMin: number, tMax: number, value1?: number | [], value2?: number | []): number | []
  • Parameters

    • t: number

      The input value to be re-mapped

    • tMin: number

      The inputs low floor

    • tMax: number

      The inputs high ceiling

    • Optional value1: number | []

      The output floor

    • Optional value2: number | []

      The output ceiling

    Returns number | []

    A given value, mapped from one range to another, clamped to the output range. The mapping will ease into the output range with a velocity of 0. If only 3 parameters are given, the input range is 0 to 1 and the given values are used for the output range.

effect

  • effect(nameOrIndex: string | number): Effect
  • Get the effect on a layer with a given name or index.

    Parameters

    • nameOrIndex: string | number

      The effect's name or index

    Returns Effect

    The first effect with the given name, or at the given index

footage

  • Gets the footage object for the item with the provided name

    Parameters

    • name: string

      The file name of the footage item

    Returns Footage

    The relevant footage item

framesToTime

  • framesToTime(frames: number, fps?: number): number
  • Converts a number of frames to time in seconds

    Parameters

    • frames: number

      The frame count to convert

    • fps: number = ...

      The frames per second use in the calculation

    Returns number

    The given frames as time

fromComp

  • fromComp<VectorType>(vec: VectorType, time?: number): VectorType
  • Transforms a given vector from the compositions space to the layer's space

    Type parameters

    Parameters

    • vec: VectorType

      The vector to transform

    • time: number = ...

      The time to sample the vector

    Returns VectorType

    The vector in the layer's space

fromCompToSurface

  • fromCompToSurface<VectorType>(vec: VectorType, time?: number): VectorType
  • Projects a point located in composition space to a point on the surface of the layer (zero z-value) at the location where it appears when viewed from the active camera.

    Type parameters

    Parameters

    • vec: VectorType

      The vector to transform

    • time: number = ...

      The time to sample the number

    Returns VectorType

    The vector in on the layers surface space

fromCompVec

  • fromCompVec<VectorType>(vec: VectorType, time?: number): VectorType
  • Type parameters

    Parameters

    • vec: VectorType
    • time: number = ...

    Returns VectorType

fromWorldVec

  • fromWorldVec<VectorType>(vec: VectorType, time?: number): VectorType
  • Type parameters

    Parameters

    • vec: VectorType
    • time: number = ...

    Returns VectorType

gaussRandom

  • gaussRandom(minValOrArray?: number | [], maxValOrArray?: number | []): number | []
  • Parameters

    • Optional minValOrArray: number | []

      If only one argument is provided, the max value for the random number, otherwise the minimum value

    • Optional maxValOrArray: number | []

      The maximum value to return

    Returns number | []

    a random value with a gaussian distribution either between 0 and 1, 0 and the first argument, or the first and second argument if two are provided. If the arguments are arrays, an equal length array of random values will be returned

hexToRgb

  • hexToRgb(hex: string): Color
  • Converts a color in hex triplet space to RGB, or in hex quartet space to RGBA space. For hex triplets, alpha defaults to 1.0

    Parameters

    • hex: string

      String representing an hex triplet (6 digits, no alpha channel) or quartet (8 digits, includes alpha channel) containing only numerals or characters A–F. Optional leading characters 0x, 0X, or # are ignored. Characters beyond 8 digits are ignored.

    Returns Color

hslToRgb

  • Converts a color in HSLA space to RGBA

    Parameters

    Returns Color

    An array of red, green, blue and alpha values between 0 and 1

length

  • Parameters

    Returns number

    The length of a given vector, or if two vectors are provided the distance between them

linear

  • linear(t: number, tMin: number, tMax: number, value1?: number | [], value2?: number | []): number | []
  • Parameters

    • t: number

      The input value to be re-mapped

    • tMin: number

      The inputs low floor

    • tMax: number

      The inputs high ceiling

    • Optional value1: number | []

      The output floor

    • Optional value2: number | []

      The output ceiling

    Returns number | []

    A given value, mapped from one range to another, clamped to the output range. If only 3 parameters are given, the input range is 0 to 1 and the given values are used for the output range.

lookAt

  • Used to orient a layer towards a given point in 3D space

    Parameters

    • fromPoint: Vector

      The location in world space of the layer you want to orient

    • atPoint: Vector

      The point in world space you want to point the layer at

    Returns Vector3D

    An orientation value that can be used to orient the layer so that the z-axis points at the atPoint

mask

  • mask(nameOrIndex: string | number): Mask
  • Get the mask on a layer with a given name or index.

    Parameters

    • nameOrIndex: string | number

      The mask's name or index

    Returns Mask

    The first mask with the given name, or at the given index

mul

  • mul<VectorType>(vec1: VectorType, amount: number): VectorType
  • Multiplies a vector by a given scalar amount

    Type parameters

    Parameters

    • vec1: VectorType

      The vector to multiply

    • amount: number

      The amount to multiply by

    Returns VectorType

noise

  • noise(valOrArray: number | []): number
  • Used to get a random value via Perlin noise, where inputs values that are close together will result in output values that are closer together.

    Parameters

    • valOrArray: number | []

      The noise input value

    Returns number

    A value between -1 and 1

normalize

radiansToDegrees

  • radiansToDegrees(radians: number): number
  • Convert a given value in radians to degrees

    Parameters

    • radians: number

      The value to convert

    Returns number

    The value radians

random

  • random(minValOrArray?: number | [], maxValOrArray?: number | []): number | []
  • Parameters

    • Optional minValOrArray: number | []

      If only one argument is provided, the max value for the random number, otherwise the minimum value

    • Optional maxValOrArray: number | []

      The maximum value to return

    Returns number | []

    a random value either between 0 and 1, 0 and the first argument, or the first and second argument if two are provided. If the arguments are arrays, an equal length array of random values will be returned

rgbToHsl

  • Converts a color in RGBA space to HSLA

    Parameters

    • rgbaArray: Color

      Input RGBA array of values between 0 and 1

    Returns Color

    An array of hue, saturation, lightness and alpha values between 0 and 1

sampleImage

  • Sample a layers color at a given point

    Parameters

    • point: Vector2D

      The center point of the sampling area, in layer space

    • radius: Vector2D = ...

      Defines the sample area size, the horizontal and vertical distance from the center

    • postEffect: boolean = true

      Whether to sample the layer after effects and masks are applied

    • time: number = ...

      The time at which to sample

    Returns Color

    The average color of the layer in the sample area

seedRandom

  • seedRandom(offset: number, timeless?: boolean): void
  • Used to modify the random seed for an expression

    Parameters

    • offset: number

      A value used to modify the random seed

    • timeless: boolean = false

      Whether the random seed should be consistent across time

    Returns void

sourceRectAtTime

  • sourceRectAtTime(time?: number, includeExtents?: boolean): SourceRect
  • Gets the layer's size and position at a given time

    Parameters

    • time: number = ...

      The time at which to get the layers bounds

    • includeExtents: boolean = false

      Whether to include areas of the layer outside the bounding box. Applies to Shape Layers and Paragraph Text.

    Returns SourceRect

    An object with properties for layers top, left, width and height values at the given time.

Optional sourceTime

  • sourceTime(time?: number): Footage
  • Returns the layer's source item at the given time

    Parameters

    • time: number = ...

      The time at which to get the source

    Returns Footage

    The source item

sub

  • sub<A, B>(a: A, b: B): MathReturn<A, B>

timeToCurrentFormat

  • timeToCurrentFormat(t?: number, fps?: number, isDuration?: boolean, ntscDropFrame?: boolean): string
  • Converts a given time in seconds to the current time display format of the Project.

    Parameters

    • t: number = ...

      The time to convert

    • fps: number = ...

      Frame rate to use for the conversion

    • isDuration: boolean = false

      Whether t represents a duration rather than an absolute time. Durations are rounded away from zero rather than down.

    • ntscDropFrame: boolean = ...

    Returns string

timeToFeetAndFrames

  • timeToFeetAndFrames(t?: number, fps?: number, framesPerFoot?: number, isDuration?: boolean): string
  • Converts a given time in seconds to a string representing feet of film and frames.

    Parameters

    • t: number = ...

      The time to convert

    • fps: number = ...

      Frame rate to use for the conversion

    • framesPerFoot: number = 16

      Number of frames in one foot of film

    • isDuration: boolean = false

      Whether t represents a duration rather than an absolute time. Durations are rounded away from zero rather than down.

    Returns string

timeToFrames

  • timeToFrames(t?: number, fps?: number, isDuration?: boolean): number
  • Converts a given time in seconds to an integer amount of frames

    Parameters

    • t: number = ...

      The time to convert in seconds

    • fps: number = ...

      Frames per second to calculate with, defaulting to the compositions frame rate

    • isDuration: boolean = false

      Whether t represents a duration rather than an absolute time. Durations are rounded away from zero rather than down.

    Returns number

    The time in frames

timeToNTSCTimecode

  • timeToNTSCTimecode(t?: number, ntscDropFrame?: boolean, isDuration?: boolean): string
  • Converts a given time value to a NTSC timecode string

    Parameters

    • t: number = ...

      The time to convert

    • ntscDropFrame: boolean = false
    • isDuration: boolean = false

      Whether t represents a duration rather than an absolute time. Durations are rounded away from zero rather than down.

    Returns string

timeToTimecode

  • timeToTimecode(t?: number, timecodeBase?: number, isDuration?: boolean): string
  • Converts the given time value to a timecode string (e.g. "00:00:00:00")

    Parameters

    • t: number = ...

      The time to convert

    • timecodeBase: number = 30

      The frames per second to use in the calculation

    • isDuration: boolean = false

      Whether t represents a duration rather than an absolute time. Durations are rounded away from zero rather than down.

    Returns string

    The time as a timecode string

toComp

  • toComp<VectorType>(vec: VectorType, time?: number): VectorType
  • Transforms a given vector from the layer's space to the composition space

    Type parameters

    Parameters

    • vec: VectorType

      The vector to transform

    • time: number = ...

      The time to sample the vector

    Returns VectorType

    The vector in the composition space

toCompVec

  • toCompVec<VectorType>(vec: VectorType, time?: number): VectorType
  • Type parameters

    Parameters

    • vec: VectorType
    • time: number = ...

    Returns VectorType

toWorld

  • toWorld<VectorType>(vec: VectorType, time?: number): VectorType
  • Transforms a given vector from the layers space to the view-independent world space

    Type parameters

    Parameters

    • vec: VectorType

      The vector to transform

    • time: number = ...

      The time to sample the number

    Returns VectorType

    The vector in world space

toWorldVec

  • toWorldVec<VectorType>(vec: VectorType, time?: number): VectorType
  • Type parameters

    Parameters

    • vec: VectorType
    • time: number = ...

    Returns VectorType

Generated using TypeDoc