beautypg.com

Vector math methods (expression reference) – Adobe After Effects User Manual

Page 686

background image

timeToCurrentFormat(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false)

To the top

add(vec1, vec2)

sub(vec1, vec2)

mul(vec, amount)

div(vec, amount)

clamp(value, limit1, limit2)

dot(vec1, vec2)

cross(vec1, vec2)

normalize(vec)

Return type: String.

Argument type: t and fps are Numbers; isDuration is a Boolean.

Converts the value of t to a String representing time in the current Project Settings display format. See timeToFrames for a definition of all of the

arguments.

An optional ntscDropFrame argument was added to the timeToCurrentFormat() function in After Effects CS5.5 and later. Default:

ntscDropFrame = thisComp.ntscDropFrame

.

If you want more control over the look of timecode in your footage, use the timeToCurrentFormat method or other timeTo methods to generate
the timecode instead of using the Timecode or Numbers effect. Create a text layer, add an expression to the Source Text property, and enter
timeToCurrentFormat() in the expression field. With this method, you can format and animate the timecode text. In addition, the timecode uses
the same display style defined by the current project settings.

Vector Math methods (expression reference)

Vector Math functions are global methods that perform operations on arrays, treating them as mathematical vectors. Unlike built-in JavaScript
methods, such as Math.sin, these methods are not used with the Math prefix. Unless otherwise specified, Vector Math methods are lenient

about dimensions and return a value that is the dimension of the largest input Array object, filling in missing elements with zeros. For example, the
expression add([10, 20], [1, 2, 3]) returns [11, 22, 3].

JJ Gifford’s website

provides explanations and examples that show how to use simple geometry and trigonometry with expressions.

Chris and Trish Meyer provide additional information about vector math methods and arrays in an article on the

ProVideo Coalition website

.

Return type: Array.

Argument type: vec1 and vec2 are Arrays.

Adds two vectors.

Return type: Array.

Argument type: vec1 and vec2 are Arrays.

Subtracts two vectors.

Return type: Array.

Argument type: vec is an Array, amount is a Number.

Multiplies every element of the vector by the amount.

Return type: Array.

Argument type: vec is an Array, amount is a Number.

Divides every element of the vector by the amount.

Return type: Number or Array.

Argument type: value, limit1, and limit2 are Numbers or Arrays.

The value of each component of value is constrained to fall between the values of the corresponding values of limit1 and limit2.

Chris and Trish Meyer provide additional information about the clamp method in an article on the

ProVideo Coalition website

.

Return type: Number.

Argument type: vec1 and vec2 are Arrays.

Returns the dot (inner) product of the vector arguments.

Return type: Array [2 or 3].

Argument type: vec1 and vec2 are Arrays [2 or 3].

Returns the vector cross product of vec1 and vec2. Refer to a math reference or JavaScript guide for more information.

Return type: Array.

Argument type: vec is an Array.

682

This manual is related to the following products: