g.js
— graphical objects for JavaScript
Home
Get Started
Reference
About
Function Reference
To see an overview per category, look at the
guides
.
abs
Convert any number to a positive value (the absolute value).
accumulate
Generate in between totals of a list of numbers.
add
Add two numbers.
align
Align a shape in relation to the origin.
and
Perform the logical AND operation.
angle
Calculate the angle between two points.
arc
Create an arc, pie or wedge shape.
average
Calculate the average of a list of numbers.
blend
Blend two images together using a blending method.
blur
Blur an image.
boolean
Create a boolean value that can be used as a variable.
bounds
Get the bounds of a shape.
brighten
Brighten an image.
bump
Apply bump distortion to an image.
ceil
Round up a number to the nearest bigger integer.
centerPoint
Calculate the geometric center point of a shape.
characterAt
Output the character at a given index.
colorImage
Create an image filled with a solid color.
colorize
Change the color of a shape.
combine
Combine multiple lists into one.
compare
Return true or false by comparing two values using a comparison operation.
compound
Add, subtract or intersect geometry.
concatenate
Add strings together.
connectPoints
Connect all points in a path.
contains
Determine if the list contains a given value.
convert
Convert values from one range to another.
coordinates
Calculate a new point based on the angle and distance from an original point.
copy
Create multiple copies of a shape.
cos
Calculate the trigonometric cosine of an angle.
count
Count the number of items in the list.
crop
Crop an image.
crossEdges
Apply a cross edges filter to an image.
cull
Keep only items from the list where the corresponding boolean is `true`.
curve
Create a quadratic curve with one off-curve point.
cycle
Repeat the items in the list until the new list is of a certain length.
degrees
Convert an angle specified in radians to degrees.
deletePaths
Delete paths based on a bounding path.
deletePoints
Delete points based on a bounding path.
dent
Apply dent distortion to an image.
desaturate
Desaturate a shape.
distance
Calculate the distance between two points.
distinct
Remove all duplicate items from a list.
divide
Divide two numbers.
e
The value of the mathematical constant e, the base of the natural logarithm.
elapsedSeconds
Get the number of seconds since the start of the animation.
ellipse
Create an ellipse or circle.
emboss
Apply an embossing filter to an image to give it a 3D shadow effect.
endsWith
Check if the string ends with a given string.
equalize
Apply an equalize filter to an image.
equals
Determine if two objects are equal.
even
Determine if a number is even.
filterData
Filter the input data by comparing the columns of each row with a value.
findEdges
Outline the edges of an image.
first
Take the first item in the list.
fit
Fit a shape within bounds.
fitTo
Fit a shape to another shape.
flip
Flip a shape or image.
floor
Round down a number to the nearest smaller integer.
frame
Get the current frame number.
get
Take an item in the list at a certain index.
glow
Apply a glow to an image.
gradientImage
Create a gradient image.
grayColor
Create a gray color.
grid
Create a grid of points.
group
Combine multiple shapes together.
groupBy
Group the data based on key/value.
hexColor
Create a color using a hexadecimal value.
histogram
Show the statistical distribution of color channel values inside an image.
hslAdjust
Adjust hue, saturation and lightness of a shape.
hslColor
Create a HSL color.
import
Import data (CSV, SVG) from a file.
integer
Create an integer value that can be used as a variable.
interleave
Mix multiple lists by alternating between them.
invert
Invert a color or the colors of a shape.
keys
Get the keys from a table.
last
Take the last item in the list.
lightTunnel
Apply a light tunnel distortion to an image.
line
Create a line between two points.
lineAngle
Create a line between a point and an angle + distance.
link
Generate a visual link between two shapes.
log
Calculate the natural logarithm.
lookup
Look up a value in a table or object.
makeNumbers
Transform a string to a list of numbers.
makePoint
Create a point from X/Y coordinates.
mask
Use an image as a mask for another image.
max
Take the largest value from a list of numbers.
merge
Combine different shapes into one.
min
Take the smallest value from a list of numbers.
mirror
Mirror the geometry around an invisible axis.
mix
Linearly interpolate between two values.
mod
Calculate the modulo by dividing two numbers and keeping the remainder.
mosaic
Create a mosaic out of an image.
mousePosition
multiply
Multiply two numbers.
negate
Switch the sign of the input value.
not
Perform the logical NOT operation.
number
Create a number value.
odd
Determine if a number is odd.
or
Perform the logical OR operation.
pathLength
Get the contour length of the path.
perlinNoise
Compute Perlin noise.
pi
The value of the mathematical constant pi.
pick
Take random items from a list.
pinch
Apply pinch distortion to an image.
pointOnPath
Calculate a point along the path.
polygon
Create a multi-sided polygon.
posterize
Posterize an image.
pow
Raise a number to the given power.
quad
Create a four-sided polygon from points.
radians
Convert an angle specified in degrees to radians.
randomNumbers
Create a list of random numbers.
randomSample
Take a random sample from a list.
range
Generate a list of numbers between a minimum and maximum.
rect
Create a rectangle or square.
removeNoise
Remove noise from an image.
repeat
Repeat the items in the list a given number of times.
resampleByAmount
Distribute points along a shape by amount.
resampleByLength
Distribute points along a shape by segment length.
rest
Take all but the first item in the list.
reverse
Reverse the items in the list. The first item becomes the last and vice versa.
rgbAdjust
Adjust red, green, blue and alpha values of an input object.
rgbColor
Create a RGB color.
rotate
Rotate the shape according to the given angle.
round
Round off a number to the nearest integer.
sample
Generate numbers within the given bounds.
sawtoothWave
Calculate a value based on a sawtooth wave.
scale
Resize the shape by scaling it.
scatterPoints
Generate random points within the boundaries of a shape.
second
Take the second item in the list.
shapeSort
Sort points or shapes using different sorting methods.
shift
Move items from the beginning of a list to the end of the list.
shuffle
Randomise the ordering of items in the list.
sign
Take the sign of a number.
sin
Calculate the trigonometric sine of an angle.
sineWave
Calculate a value based on a sine wave.
skew
Skew the shape.
slice
Take a portion of the list.
snap
Snap geometry to a grid.
solarize
Solarize an image.
sort
Sort the items in the list.
sqrt
Calculate the square root of a number.
squareWave
Calculate a value based on a square wave.
stack
Arrange shapes in a horizontal or vertical layout.
star
Create a star shape.
startsWith
Check if the string starts with a given string.
string
Create a string value that can be used as a variable.
stringContains
Determine if the string contains a given substring.
stringEquals
Determine if the string equals a given string.
stringLength
Count the number of characters in a string.
stringReplace
Replace part of a string.
stringSplit
Split a string into a list of strings.
stringTrim
Remove white space from the start and end of the string.
substring
Take a portion of a string.
subtract
Subtract two numbers.
switch
Select one of multiple inputs based on an index.
takeEvery
Take every `n`th element of a list.
tan
Calculate the trigonometric tangens of an angle.
text
Create a text element.
textPath
Create a path out of text.
ticks
Generate tick values for use in axes.
toBitmap
Convert a vector shape to a bitmap.
toCharacterCodes
Convert a string into a list of character codes.
toCharacters
Create a list of characters from a string.
toLowerCase
Convert a string to lower case (small letters).
toPixels
Convert an image to a list of pixels.
toPoints
Convert the shape to points that make up the shape.
toTitleCase
Convert a string to title case.
toUpperCase
Convert a string to upper case (small letters).
toWords
total
Calculate the sum of a list of numbers.
translate
Move the shape, changing its position.
triangleWave
Calculate a value based on a triangle wave.
twirl
Apply twirl distortion to an image.
ungroup
Decompose the input group into a list of paths.
wiggleContours
Shift elements of a shape by a random amount.
wigglePaths
Shift paths of a group by a random amount.
wigglePoints
Shift points of the shape by a random amount.
wordCount
Count the number of words in a string.
xor
Perform the logical XOR operation.
zipMap
Combine a list of keys and values together in a map.