Skip to content

Latest commit

 

History

History
498 lines (201 loc) · 12.6 KB

File metadata and controls

498 lines (201 loc) · 12.6 KB

CameraPath

Summary

A camera path and its position, speed or FOV knots

Instance Properties

NameReturn TypeDescription
indexnumber
Read-only
Returns the index of this Camera Path in Sketch.cameraPaths
layerLayer
Read/Write
The layer the camera path is on
groupGroup
Read/Write
The group this camera path is part of
activeboolean
Read/Write
Gets or sets whether this Camera Path is active
transformTransform
Read/Write
The transform of the camera path
positionVector3
Read/Write
The 3D position of the Camera Path (usually but not always its first position knot)
rotationRotation
Read/Write
The 3D orientation of the Brush Camera Path
scalenumber
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
activebooleanOn 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
pathPathThe Path to convert
loopedbooleanWhether 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
stepnumberThe 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
positionVector3The position of the new knot
rotationRotationThe rotation of the new knot
smoothingnumberControls 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
tnumberThe time along the path to insert the new knot
rotationRotationThe rotation of the new knot
smoothingnumberControls 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
positionVector3The position of the new knot
rotationRotationThe 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
tnumberThe time along the path to insert the new knot
rotationRotationThe 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
positionVector3The position of the new knot
fovnumberThe 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
tnumberThe time along the path to insert the new knot
fovnumberThe 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
positionVector3The position of the new knot
speednumberThe 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
tnumberThe time along the path to insert the new knot
speednumberThe 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
positionVector3The position to extend the camera path to
rotationRotationThe rotation of the camera path at the extended position
smoothingnumberThe smoothing factor applied to the new point
atStartbooleanfalseDetermines 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
timenumberThe time at which to sample the camera path
loopbooleantrueDetermines whether the camera path should loop
pingpongbooleanfalseDetermines 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
tolerancenumberThe tolerance used for simplification
smoothingnumberThe smoothing factor used for simplification

Example

newPath = oldPath:Simplify(1.2, 1)