Adobe Illustrator CS6 Type Library JS: Math

Illustrator CS6

Class

Math

 A global object containing a set of math functions and constants.

QuickLinks

abs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, max, min, pow, random, round, sin, sqrt, tan

Class

PropertyTypeAccessDescription
Enumber readonlyEuler's constant and the base of natural logarithms. (default: 2.7182818284590452354)
LN10number readonlyThe natural logarithm of 10. (default: 2.302585092994046)
LN2number readonlyThe natural logarithm of 2. (default: 0.6931471805599453)
LOG10Enumber readonlyThe base 10 logarithm of e. (default: 0.4342944819032518)
LOG2Enumber readonlyThe base 2 logarithm of e. (default: 1.4426950408886934)
PInumber readonlyThe ratio of the circumference of a circle to its diameter. (default: 3.14159265358979323846)
SQRT1_2number readonlyThe reciprocal of the square root of 1/2. (default: 0.7071067811865476)
SQRT2number readonlyThe square root of 2. (default: 1.4142135623730951)

Methods

number abs (x: number)
Returns the absolute value of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.abs(x)

number acos (x: number)
Returns the arc cosine(in radians) of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.acos(x)

number asin (x: number)
Returns the arc sin(in radians) of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.asin(x)

number atan (x: number)
Returns the arc tangent(in radians) of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.atan(x)

number atan2 (y: number, x: number)
Returns the arc tangent of the quotient of its arguments (y/x).

ParameterTypeDescription
ynumberA number.
xnumberA number.

ExampleMath.atan2(y,x)

number ceil (x: number)
Rounds the number up to the nearest integer.

ParameterTypeDescription
xnumberA number.

ExampleMath.ceil(x)

number cos (x: number)
Returns the cosine of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

ExampleMath.cos(x)

number exp (x: number)
Returns Math.E raised to the power of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.exp(x)

number floor (x: number)
Rounds a number down to the nearest integer.

ParameterTypeDescription
xnumberA number.

ExampleMath.floor(x)

number log (x: number)
Returns the natural logarithm of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.log(x)

number max (x: number, y: number)
Returns the maximum of two numbers.

ParameterTypeDescription
xnumber
ynumber

ExampleMath.max(x,y)

number min (x: number, y: number)
Returns the minimum of two numbers.

ParameterTypeDescription
xnumberNumbers.
ynumber

ExampleMath.min(x,y)

number pow (x: number, y: number)
Returns x raised to the power of y.

ParameterTypeDescription
xnumberNumbers.
ynumber

ExampleMath.pow(x,y)

number random ()
Returns a pseudo-random number from 0.0 up to but not including 1.0. Range: 0.0 - 0.999999999999999

ExampleMath.random()

number round (x: number)
Rounds a number to the nearest integer.

ParameterTypeDescription
xnumberA number.

ExampleMath.round(x)

number sin (x: number)
Returns the sine of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

ExampleMath.sin(x)

number sqrt (x: number)
Returns the square root of a number.

ParameterTypeDescription
xnumberA number.

ExampleMath.sqrt(x)

number tan (x: number)
Returns the tangent of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

ExampleMath.tan(x)
Jongware, 25-Nov-2012 v3.0.3iContents :: Index