CameraPath

Summary

A camera path and its position, speed or FOV knots

Instance Properties

NameReturn TypeDescription

index

number Read-only

Returns the index of this Camera Path in Sketch.cameraPaths

layer

Layer Read/Write

The layer the camera path is on

group

Group Read/Write

The group this camera path is part of

active

boolean Read/Write

Gets or sets whether this Camera Path is active

transform

Transform Read/Write

The transform of the camera path

position

Vector3 Read/Write

The 3D position of the Camera Path (usually but not always its first position knot)

rotation

Rotation Read/Write

The 3D orientation of the Brush Camera Path

scale

number Read/Write

The scale of the camera path

Class Methods

CameraPath:RenderActivePath()

Renders the currently active path

Returns: nil

Example

CameraPath:RenderActivePath()

CameraPath:ShowAll()

Shows all camera paths

Returns: nil

Example

CameraPath:ShowAll()

CameraPath:HideAll()

Hides all camera paths

Returns: nil

Example

CameraPath:HideAll()

CameraPath:PreviewActivePath(active)

Turns previews on or off for the active path

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

On is true, off is false

Example

CameraPath:PreviewActivePath(true)

CameraPath:New()

Creates a new empty camera path

Returns: CameraPath (The new CameraPath)

Example

CameraPath:New()

CameraPath:FromPath(path, looped)

Creates a camera path from a Path

Returns: CameraPath (A new CameraPath)

Parameters:

NameTypeDefaultDescription

path

The Path to convert

looped

boolean

Whether the resulting CameraPath should loop

Example

myCameraPath = Camera:FromPath(myPath, false)

CameraPath:RecordActivePath()

Records the active camera path

Returns: nil

Example

CameraPath:

Instance Methods

cameraPath:Delete()

Deletes a camera path

Returns: nil

Example

mycameraPath:Delete()

cameraPath:AsPath(step)

Converts the camera path to a path by sampling it at regular time intervals

Returns: Path (The new Path)

Parameters:

NameTypeDefaultDescription

step

number

The time step is use for each sample

Example

myPath = myCameraPath:AsPath(0.5)

cameraPath:Duplicate()

Duplicates the camera path

Returns: CameraPath (The copy of the specied CameraPath)

Example

mynewPath = myOldPath:Duplicate()

cameraPath:InsertPosition(position, rotation, smoothing)

Inserts a new position knot. (Position must be close to the existing path)

Returns: number (The index of the new knot, or -1 if the position is too far from the path)

Parameters:

NameTypeDefaultDescription

position

The position of the new knot

rotation

The rotation of the new knot

smoothing

number

Controls the spline curvature for this knot

Example

myCameraPath:InsertPosition(pos, rot, 0.5

cameraPath:InsertPositionAtTime(t, rotation, smoothing)

Inserts a new position knot into the path at the specified time

Returns: number (The index of the new knot)

Parameters:

NameTypeDefaultDescription

t

number

The time along the path to insert the new knot

rotation

The rotation of the new knot

smoothing

number

Controls the spline curvature for this knot

Example

myCameraPath:InsertPositionAtTime(1.5, rot, 0.5

cameraPath:InsertRotation(position, rotation)

Inserts a rotation knot at the specified position close to the existing path

Returns: number (The index of the new knot, or -1 if the position is too far from the path)

Parameters:

NameTypeDefaultDescription

position

The position of the new knot

rotation

The rotation of the new knot

Example

myCameraPath:InsertRotation(pos, rot

cameraPath:InsertRotationAtTime(t, rotation)

Inserts a rotation knot at the specified time

Returns: number (The index of the new knot)

Parameters:

NameTypeDefaultDescription

t

number

The time along the path to insert the new knot

rotation

The rotation of the new knot

Example

myCameraPath:InsertRotationAtTime(1.5, rot

cameraPath:InsertFov(position, fov)

Inserts a field of view knot at the specified position close to the existing path

Returns: number (The index of the new knot, or -1 if the position is too far from the path)

Parameters:

NameTypeDefaultDescription

position

The position of the new knot

fov

number

The field of view of the new knot

Example

myCameraPath:InsertFov(pos, 45

cameraPath:InsertFovAtTime(t, fov)

Inserts a fov knot at the specified time

Returns: number (The index of the new knot)

Parameters:

NameTypeDefaultDescription

t

number

The time along the path to insert the new knot

fov

number

The field of view of the new knot

Example

myCameraPath:InsertFovAtTime(2.5, 45

cameraPath:InsertSpeed(position, speed)

Inserts a speed knot at the specified position close to the existing path

Returns: number (The index of the new knot, or -1 if the position is too far from the path)

Parameters:

NameTypeDefaultDescription

position

The position of the new knot

speed

number

The speed of the new knot

Example

myCameraPath:InsertSpeed(position, 1.5

cameraPath:InsertSpeedAtTime(t, speed)

Inserts a speed knot at the specified time

Returns: number (The index of the new knot)

Parameters:

NameTypeDefaultDescription

t

number

The time along the path to insert the new knot

speed

number

The speed of the new knot

Example

myCameraPath:InsertSpeedAtTime(2.5, 2

cameraPath:Extend(position, rotation, smoothing, atStart)

Extends the camera path

Returns: nil

Parameters:

NameTypeDefaultDescription

position

The position to extend the camera path to

rotation

The rotation of the camera path at the extended position

smoothing

number

The smoothing factor applied to the new point

atStart

boolean

false

Determines whether the extension is done at the start or end of the camera path. True=start, false=end

Example

myCameraPath:Extend(pos, rot, 1.2, true

cameraPath:Loop()

Loops the camera path

Returns: nil

Example

myCameraPath:Loop

cameraPath:Sample(time, loop, pingpong)

Samples the camera path at the specified time

Returns: Transform (The sampled transform of the camera at the specified time)

Parameters:

NameTypeDefaultDescription

time

number

The time at which to sample the camera path

loop

boolean

true

Determines whether the camera path should loop

pingpong

boolean

false

Determines whether the camera path should pingpong (reverse direction every loop

Example

myTransform = myCameraPath:Sample(2.5, true, false)

cameraPath:Simplify(tolerance, smoothing)

Simplifies the camera path

Returns: CameraPath (A new simplified Camera Path)

Parameters:

NameTypeDefaultDescription

tolerance

number

The tolerance used for simplification

smoothing

number

The smoothing factor used for simplification

Example

newPath = oldPath:Simplify(1.2, 1)

Last updated