Snap.svg API & Examples

Go To:

elem.addClass(value) Adds given class name or list of class names to the element.
Top⇧
elem.addStop(color, offset)
stops offset 0..100
Only for gradients! Adds another stop to the gradient.
Top⇧
elem.after(el) Inserts given element downward from the current one, and returns both to top.
Top⇧
elem.animate(attrs, duration, [easing], [callback])

attrs |object| key-value pairs of destination attributes
duration |number| duration of the animation in milliseconds
easing |function| easing function from mina or custom
callback |function| callback function that executes when the animation ends
Animates the given attributes of the element
Top⇧
elem.append(el) Appends the given element to current one
Top⇧
elem.appendTo(el) Appends the current element to the given one
Top⇧
elem.asPX(attr, [value]) Returns given attribute of the element as a numerical px value (not %, em, etc.)
Top⇧
elem.attr(...)

key-value pairs of attributes
or
name of the attribute
Gets or sets given attributes of the element.
Top⇧
elem.before(el) Inserts given element before the current one
Top⇧
elem.children() Returns array of all the children of the element.
Top⇧
elem.click(handler) Adds a click event handler to the element
Top⇧
elem.clone() Creates a clone of the element and inserts it after the element
Top⇧
elem.data(key, [value])

Adds or retrieves given value associated with given key. (Don't confuse with data- attributes)
Top⇧
elem.dblclick(handler)

Adds a double click event handler to the element.
Top⇧
elem.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])

dx - shift by x from the start point
dy - shift by y from the start point
x - x position of the mouse
y - y position of the mouse
event - DOM event object
Adds event handlers for an element's drag gesture
Top⇧
elem.getBBox()

Returns:
cx: x of the center
cy: y of the center
h: height
height: height
path: path command for the box
r0: radius of a circle that fully encloses the box
r1: radius of the smallest circle that can be enclosed
r2: radius of the largest circle that can be enclosed
vb:string box as a viewbox command
w: width
width: width
x2: x of the right side
x: x of the left side
y2: y of the bottom edge
y: y of the top edge
Returns the bounding box descriptor for the given element
Top⇧
elem.getPointAtLength(length)

Returns coordinates of the point located at the given length on the given path
Top⇧
elem.getSubpath(from, to)

Returns subpath of a given element from given start and end lengths
Top⇧
elem.getTotalLength()

Returns the length of the path in pixels
Top⇧
elem.hasClass(value)

Checks if the element has a given class name in the list of class names applied to it.
Top⇧
elem.hover(f_in, f_out, [icontext], [ocontext])

Adds hover event handlers to the element
Top⇧
elem.inAnim()

Returns a set of animations that may be able to manipulate the current element
Top⇧
elem.innerSVG()

Returns SVG code for the element's contents, equivalent to HTML's innerHTML
Top⇧
elem.insertAfter(el)

Inserts the element after the given one
Top⇧
elem.insertBefore(el)

Inserts the element before the given one
Top⇧
elem.marker(x, y, width, height, refX, refY)

Creates a element from the current element To create a marker you have to specify the bounding rect and reference point
Top⇧
elem.mousedown(handler)

Adds a mousedown event handler to the element
Top⇧
elem.mousemove(handler)

Adds a mousemove event handler to the element
Top⇧
elem.mouseout(handler)

Adds a mouseout event handler to the element
Top⇧
elem.mouseover(handler)

Adds a mouseover event handler to the element
Top⇧
elem.mouseup(handler)

Adds a mouseup event handler to the element
Top⇧
elem.node

Gives you a reference to the DOM object, so you can assign event handlers or just mess around :)
Top⇧
elem.outerSVG()

Returns SVG code for the element, equivalent to HTML's outerHTML.
Top⇧
elem.parent()

Returns the element's parent
Top⇧
elem.prepend(el)

Prepends the given element to the current one
Top⇧
elem.prependTo(el)

Prepends the current element to the given one
Top⇧
elem.remove()

Removes element from the DOM
Top⇧
elem.removeClass(value)

Removes given class name or list of class names from the element.
Top⇧
elem.removeData([key])

Removes value associated with an element by given key. If key is not provided, removes all the data of the element.
Top⇧
elem.select(query)

Gathers the nested Element matching the given set of CSS selectors
Top⇧
elem.selectAll(query)

Gathers nested Element objects matching the given set of CSS selectors
Top⇧
elem.setStops(str)

Only for gradients! Updates stops of the gradient based on passed gradient descriptor.
Top⇧
elem.stop()

Stops all the animations for the current element
Top⇧
elem.stops()

Only for gradients! Returns array of gradient stops elements.
Top⇧
elem.toDefs()

Moves element to the shared <defs> area
Top⇧
elem.toJSON()

Returns object representation of the given element and all its children.
Top⇧
elem.toPattern(x, y, width, height)

Creates a <pattern> element from the current element To create a pattern you have to specify the pattern rect.
Top⇧
elem.toString()

Returns SVG code for the element, equivalent to HTML's outerHTML. (same as elem.outerSVG)
Top⇧
elem.toggleClass(value, flag)

value (string) class name or space separated list of class names

flag (true/false) value to determine whether the class should be added or removed
Add or remove one or more classes from the element, depending on either the class's presence or the value of the flag argument.
Top⇧
elem.touchcancel(handler)

Adds a touchcancel event handler to the element
Top⇧
elem.touchend(handler)

Adds a touchend event handler to the element
Top⇧
elem.touchmove(handler)

Adds a touchmove event handler to the element
Top⇧
elem.touchstart(handler)

Adds a touchstart event handler to the element
Top⇧
elem.transform(tstr)

tstr - transform string in Snap or SVG format

Snap format:
translate - t(x,y)
scale - s(x,y)
rotate - r(angle,x,y)
skew - skewX(xAngle), skewY(yAngle), skew(xAngle,yAngle)
Gets or sets transformation of the element
Top⇧
elem.type

SVG tag name of the given element.
Top⇧
elem.unclick(handler)

Removes a click event handler from the element
Top⇧
elem.undblclick(handler)

Removes a double click event handler from the element
Top⇧
elem.undrag()

Removes all drag event handlers from the given element
Top⇧
elem.unhover(f_in, f_out)

Removes hover event handlers from the element
Top⇧
elem.unmousedown(handler)

Removes a mousedown event handler from the element
Top⇧
elem.unmousemove(handler)

Removes a mousemove event handler from the element
Top⇧
elem.unmouseout(handler)

Removes a mouseout event handler from the element
Top⇧
elem.unmouseover(handler)

Removes a mouseover event handler from the element
Top⇧
elem.unmouseup(handler)

Removes a mouseup event handler from the element
Top⇧
elem.untouchcancel(handler)

Removes a touchcancel event handler from the element
Top⇧
elem.untouchend(handler)

Removes a touchend event handler from the element
Top⇧
elem.untouchmove(handler)

Removes a touchmove event handler from the element
Top⇧
elem.untouchstart(handler)

Removes a touchstart event handler from the element
Top⇧
elem.use()

Creates a <use> element linked to the current element
Top⇧
Fragment.select(query)

Gathers the nested Fragment matching the given set of CSS selectors
Top⇧
Fragment.selectAll(query)

Gathers nested Fragment objects matching the given set of CSS selectors
Top⇧
Matrix.add(...)

Numbers: (a,b,c,d,e,f)
or
Matrix Object
Adds the given matrix to existing one
Top⇧
Matrix.clone()

Returns a copy of the matrix
Top⇧
Matrix.determinant()

Finds determinant of the given matrix.
Top⇧
Matrix.invert()

Returns an inverted version of the matrix
Top⇧
Matrix.multLeft(...)

Numbers: (a,b,c,d,e,f)
or
Matrix Object
Multiplies a passed affine transform to the left: M * this
Top⇧
Matrix.rotate(a, x, y)

a - angle of rotation, in degrees
x - horizontal origin point from which to rotate
y - vertical origin point from which to rotate
Rotates the matrix
Top⇧
Matrix.scale(x, *y, [cx], [cy])

x - amount to be scaled, with 1 resulting in no change
*y (required) - amount to scale along the vertical axis .
cx - horizontal origin point from which to scale
cy - vertical origin point from which to scale
Scales the matrix
Top⇧
Matrix.skew(y, x)

y - Angle to skew along the y-axis (in degrees).
x - Angle to skew along the x-axis (in degrees).
Skews the matrix
Top⇧
Matrix.skewX(x)

x - Angle to skew along the x-axis (in degrees).
Skews the matrix along the x-axis
Top⇧
Matrix.skewY(y)

y - Angle to skew along the y-axis (in degrees).
Skews the matrix along the y-axis
Top⇧
Matrix.split()

dx - translation by x
dy - translation by y
scalex - scale by x
scaley - scale by y
shear - shear
rotate - rotation in deg
isSimple - true/false: could it be represented via simple transformations
Splits matrix into primitive transformations
Top⇧
Matrix.toTransformString()

Returns transform string that represents given matrix
Top⇧
Matrix.translate(x, y)

x - horizontal offset distance
y - vertical offset distance
Translate the matrix
Top⇧
Matrix.x(x, y)

Returns x coordinate for given point after transformation described by the matrix.
Top⇧
Matrix.y(x, y)

Returns y coordinate for given point after transformation described by the matrix.
Top⇧
SNPsvg = Snap("#mySVG")
SNPsvg.circle(x, y, r)

x - x coordinate of the centre
y - y coordinate of the centre
r -radius
feature_description
Top⇧
SNPsvg.clear()

Removes all child nodes of the SNPsvg, except <defs>.
Top⇧
SNPsvg.el(name)

Creates an element on SNPsvg with a given name and no attributes
Top⇧
SNPsvg.ellipse(x, y, rx, ry)

x - x coordinate of the centre
y - coordinate of the centre
rx - horizontal radius
ry - vertical radius
Draws an ellipse
Top⇧
SNPsvg.filter(filstr)

filstr - SVG fragment of filter provided as a string
Creates a <filter> element
Top⇧
SNPsvg.g([varargs])

varargs - ...elements to nest within the group
create and fill a group element
Top⇧
SNPsvg.gradient(gradient)

Creates a gradient element
Top⇧
SNPsvg.group()

create and fill a group element
Top⇧
SNPsvg.image(src, x, y, width, height)

src - URI of the source image
x - x offset position
y - y offset position
width - width of the image
height - height of the image
Places an image on the surface
Top⇧
SNPsvg.line(x1, y1, x2, y2)

x1 - x coordinate position of the start
y1 - y coordinate position of the start
x2 - x coordinate position of the end
y2 - y coordinate position of the end
Draws a line
Top⇧
SNPsvg.mask()

Creates an empty mask element.
Top⇧
SNPsvg.path([pathString])

Creates a <path> element using the given string as the path's definition
Top⇧
SNPsvg.polygon(...)

Draws a polygon
Top⇧
SNPsvg.polyline(...)

feature_description
Top⇧
SNPsvg.ptrn(x, y, width, height, vbx, vby, vbw, vbh)

x - (optional) X of the element
y - (optional) Y of the element
width - (optional) width of the element
height - (optional) height of the element
vbx - (optional) viewbox X
vby - (optional) viewbox Y
vbw - (optional) viewbox width
vbh - (optional) viewbox height
Creates a pattern
Top⇧
SNPsvg.rect(x, y, width, height, [rx], [ry])

x - x coordinate of the top left corner
y - coordinate of the top left corner
width - width
height - height
rx - horizontal radius for rounded corners, default is 0
ry - vertical radius for rounded corners, default is rx or 0
Draws a rectangle
Top⇧
SNPsvg.svg(x, y, width, height, vbx, vby, vbw, vbh)

x - (optional) X of the element
y - (optional) Y of the element
widht - (optional) width of the element
height - (optional) height of the element
vbx - (optional) viewbox X
vby - (optional) viewbox Y
vbw - (optional) viewbox width
vbh - (optional) viewbox height
Creates a nested SVG element.
Top⇧
SNPsvg.symbol(vbx, vby, vbw, vbh)

vbx - (optional) viewbox X
vby - (optional) viewbox Y
vbw - (optional) viewbox width
vbh - (optional) viewbox height
Creates a <symbol> element.
Top⇧
SNPsvg.text(x, y, text)

x - x coordinate position
y - y coordinate position
text - (string or array) The text string to draw or array of strings to nest within separate <tspan> elements
Draws a text string
Top⇧
SNPsvg.toDataURL()

Returns SVG code for the SNPsvg as Data URI string.
Top⇧
SNPsvg.toString()

Returns SVG code string for the SNPsvg
Top⇧
SNPsvg.use(id)

id - element or element id string
Creates a <use> element.
Top⇧
Set.animate(...)

attrs - key value pairs of destination attributes
duration - duration of the animation in milliseconds
easing - easing function from mina or custom
callback - callback function that executes when the animation ends

Or

animation - array of animation parameter for each element of the set in format: [attrs, duration, easing, callback]
Animates each element in set in sync.
Top⇧
Set.attr()

Equivalent of Element.attr.
Top⇧
Set.bind(...)

attr - attribute name
callback - function to run

or
attr - attribute name
element - specific element in the set to apply the attribute to

or
attr - attribute name
element - specific element in the set to apply the attribute to
eattr - attribute on the element to bind the attribute to
Specifies how to handle a specific attribute when applied to a set.
Top⇧
Set.clear()

Removes all elements from the set
Top⇧
Set.exclude(element)

Removes given element from the set
Top⇧
Set.forEach(callback, thisArg)

Executes given function for each element in the set If the function returns false, the loop stops running.
Top⇧
Set.getBBox()

Union of all bboxes of the set.
Top⇧
Set.insertAfter()

Creates a clone of the set.
Top⇧
Set.pop()

Removes last element and returns it
Top⇧
Set.push()

Adds each argument to the current set
Top⇧
Set.remove()

Removes all children of the set.
Top⇧
Set.splice(index, count, [insertion...])

index - position of the deletion
count - number of element to remove
insertion... - elements to insert
Removes range of elements from the set
Top⇧
Snap.Matrix()

Matrix constructor, extend on your own risk. To create matrices use Snap.matrix.
Top⇧
Snap.Set

Set constructor.
Top⇧
Snap.acos(num)

Equivalent to Math.acos() only works with degrees, not radians.
Top⇧
Snap.ajax(...)

url - URL
postData - string data for post request
callback - function callback
scope - scope of callback

or
urls - URL
callback - callback
scopeo - scope of callback
Simple implementation of Ajax
Top⇧
Snap.angle(x1, y1, x2, y2, [x3], [y3])

Returns an angle between two or three points
Top⇧
Snap.animate(from, to, setter, duration, [easing], [callback])

from - number or array of numbers
ton - number or array of numbers
setter - caring function that accepts one number argument
duration - duration, in milliseconds
easing - easing function from mina or custom
callback - callback function to execute when animation ends
Runs generic animation of one number into another with a caring function
Top⇧
Snap.animation(attr, duration, [easing], [callback])

attr - attributes of final destination
duration - duration of the animation, in milliseconds
easing - one of easing functions of mina or custom one
callback - ncallback function that fires when animation ends
Creates an animation object
Top⇧
Snap.asin(num)

Equivalent to Math.asin() only works with degrees, not radians.
Top⇧
Snap.atan(num)

Equivalent to Math.atan() only works with degrees, not radians.
Top⇧
Snap.atan2(num)

Equivalent to Math.atan2() only works with degrees, not radians.
Top⇧
Snap.closestPoint(path, x, y)

Returns closest point to a given one on a given path.
Top⇧
Snap.color(clr)

Parses the color string and returns an object featuring the color's component values
Top⇧
Snap.cos(angle)

Equivalent to Math.cos() only works with degrees, not radians.
Top⇧
Snap.deg(rad)

Transform angle to degrees
Top⇧
Snap.deurl(value)

Unwraps path from "url(<path>)".
Top⇧
Snap.filter

Snap Filter Object
Top⇧
Snap.filter.blur(x, [y])

x - amount of horizontal blur, in pixels
y - amount of vertical blur, in pixels
Returns an SVG markup string for the blur filter
Top⇧
Snap.filter.brightness(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the brightness filter
Top⇧
Snap.filter.contrast(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the contrast filter
Top⇧
Snap.filter.grayscale(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the grayscale filter
Top⇧
Snap.filter.hueRotate(angle)

Returns an SVG markup string for the hue-rotate filter
Top⇧
Snap.filter.invert(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the invert filter
Top⇧
Snap.filter.saturate(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the saturate filter
Top⇧
Snap.filter.sepia(amount)

amount - amount of filter (0..1)
Returns an SVG markup string for the sepia filter
Top⇧
Snap.filter.shadow(...)

dx - horizontal shift of the shadow, in pixels
dy - vertical shift of the shadow, in pixels
blur - amount of blur
color - color of the shadow
opacity - 0..1 opacity of the shadow

Or
dx - horizontal shift of the shadow, in pixels
dy - vertical shift of the shadow, in pixels
color - color of the shadow
opacity - 0..1 opacity of the shadow
(which makes blur default to 4.)

Or
dx - horizontal shift of the shadow, in pixels
dy - vertical shift of the shadow, in pixels
opacity - 0..1 opacity of the shadow
Returns an SVG markup string for the shadow filter
Top⇧
Snap.flat

Color Selections:
Contains 20 Flat UI:Hex colours.
Top⇧
Snap.format(token, json)

token - string to format
json - object which properties are used as a replacement
Replaces construction of type {<name>} to the corresponding argument
Top⇧
Snap.fragment(varargs)

varargs...SVG string
Creates a DOM fragment from a given list of elements or strings
Top⇧
Snap.getElementByPoint(x, y)

Returns topmost element under given point.
Top⇧
Snap.getRGB(color)

Color name (red, green, cornflowerblue, etc)
#... - shortened HTML color: (#000, #fc0, etc.))
#......-full length HTML color: (#000000, #bd2300))
rgb(..., ..., ...)-red, green and blue channels values: (rgb(200, 100, 0)))
rgba(..., ..., ..., ...)-also with opacity)
rgb(...%, ...%, ...%)-same as above, but in %: (rgb(100%, 175%, 0%)))
rgba(...%, ...%, ...%, ...%)-also with opacity)
hsb(..., ..., ...)-hue, saturation and brightness values: (hsb(0.5, 0.25, 1)))
hsba(..., ..., ..., ...)-also with opacity)
hsb(...%, ...%, ...%)-same as above, but in % )
hsba(...%, ...%, ...%, ...%)-also with opacity)
hsl(..., ..., ...)-hue, saturation and luminosity values: (hsb(0.5, 0.25, 0.5)))
hsla(..., ..., ..., ...)-also with opacity )
hsl(...%, ...%, ...%)-same as above, but in %)
hsla(...%, ...%, ...%, ...%)-also with opacity)
Note that % can be used any time: rgb(20%, 255, 50%))
Parses color string as RGB object
Top⇧
Snap.hsb(h, s, b)

h - hue s - saturation b - value or brightness
Converts HSB values to a hex representation of the color
Top⇧
Snap.hsb2rgb(h, s, v)

h - hue
s - saturation
v - value or brightness
Converts HSB values to an RGB object
Top⇧
Snap.hsl(h, s, l)

h -hue
s - saturation
l - luminosity
Converts HSL values to a hex representation of the color
Top⇧
Snap.hsl2rgb(h, s, l)

h -hue
s - saturation
l - luminosity
Converts HSL values to an RGB object
Top⇧
Snap.importMUIColors()

Accepts two arguments and returns the hex value of the color:
name - Color name (e.g. red , bluegrey )
shade - Color shade (e.g. 600 , 700 ) [Default: 500 ]
e.g. lightblue[700] returns "#0288d1"
Contains 190 Material UI Colors

Top⇧
Snap.is(o, type)

o - any object or primitive type - name of the type, e.g., string, function, number, etc.
Handy replacement for the typeof operator
Top⇧
Snap.len(x1, y1, x2, y2)

Returns distance between two points
Top⇧
Snap.len2(x1, y1, x2, y2)

Returns squared distance between two points
Top⇧
Snap.load(url, callback, [scope])

url - URL
callback - callback
scope - scope of callback
Loads external SVG file as a Fragment
Top⇧
Snap.matrix(...)

a,b,c,d,e,f

or
svgMatrix
Utility method Returns a matrix based on the given parameters
Top⇧
Snap.mui

For colour reference: https://www.materialui.co

Color Selections:
Contains 19 UI:Hex colours.
Top⇧
Snap.parse(svg)

svg - SVG string
Parses SVG fragment and converts it into a Fragment
Top⇧
Snap.parsePathString(pathString)

Utility method Parses given path string into an array of arrays of path segments
Top⇧
Snap.parseTransformString(TString)

Utility method Parses given transform string into an array of transformations
Top⇧
Snap.path.bezierBBox(...)

Parameters (...):
p1x - x of the first point of the curve
p1y - y of the first point of the curve
c1x - x of the first anchor of the curve
c1y - y of the first anchor of the curve
c2x - x of the second anchor of the curve
c2y - y of the second anchor of the curve
p2x - x of the second point of the curve
p2y - y of the second point of the curve
Utility method Returns the bounding box of first segment for a cubic bezier curve
Top⇧
Snap.path
.findDotsAtSegment (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t)

p1x - x of the first point of the curve
p1y - y of the first point of the curve
c1x - x of the first anchor of the curve
c1y - y of the first anchor of the curve
c2x - x of the second anchor of the curve
c2y - y of the second anchor of the curve
p2x - x of the second point of the curve
p2y - y of the second point of the curve
t - position on the curve (0..1)
Utility method Finds dot coordinates on the given cubic bezier curve at the given t
Top⇧
Snap.path.
getBBox(pathString)

Returns:
x - x coordinate of the left top point of the box
y - y coordinate of the left top point of the box
x2 - x coordinate of the right bottom point of the box
y2 - y coordinate of the right bottom point of the box
width - width of the box
height - height of the box
Utility method Returns the bounding box of a given path
Top⇧
Snap.path.
getPointAtLength(path, length)

path - SVG path
length - length, in pixels, from the start of the path, excluding non-rendering jumps
Returns the coordinates of the point located at the given length along the given path
Top⇧
Snap.path.
getSubpath(pathString, from, to)

pathString - SVG path string
from - length, in pixels, from the start of the path to the start of the segment
to - length, in pixels, from the start of the path to the end of the segment

Returns: path string definition for the segment
Returns the subpath of a given path between given start and end lengths
Top⇧
Snap.path.
getTotalLength(pathString)

Returns the length of the given path in pixels
Top⇧
Snap.path.
intersection(path1String, path2String)

Returns:
x - x coordinate of the point
y - y coordinate of the point
t1 - t value for segment of path1
t2 - t value for segment of path2
segment1 - order number for segment of path1
segment2 - order number for segment of path2
bez1 - [array] eight coordinates representing bezier curve for the segment of path1
bez2 - [array] eight coordinates representing bezier curve for the segment of path2
Utility method finds intersections of two paths
Top⇧
Snap.path.
isBBoxIntersect(bbox1, bbox2)

bbox1 - object: first bounding box
bbox2 - object: second bounding box
Utility method Returns true if two bounding boxes intersect
Top⇧
Snap.path.
isPointInside(pathString, x, y)

x - x of the point
y - y of the point
Utility method Returns true if given point is inside a given closed path.
Top⇧
Snap.path.
isPointInsideBBox(bbox, x, y)

bbox - object: bounding box
x - x coordinate of the point
y - y coordinate of the point
Utility method Returns true if given point is inside bounding box
Top⇧
Snap.path.map(path, matrix)

path - path string
matrix - Matrix
Transform the path string with the given matrix
Top⇧
Snap.path.toAbsolute(path)

path - path string
Utility method Converts path coordinates into absolute values
Top⇧
Snap.path.toCubic(pathString)

Utility method Converts path to a new path where all segments are cubic bezier curves
Top⇧
Snap.path.
toRelative(pathString)

Utility method Converts path coordinates into relative values
Top⇧
Snap.plugin(f)

Let you write plugins. You pass in a function with five arguments
Top⇧
Snap.rad(deg)

Transform angle to radians
Top⇧
Snap.rgb(r, g, b)

Converts RGB values to a hex representation of the color
Top⇧
Snap.rgb2hsb(r, g, b)

Converts RGB values to an HSB object
Top⇧
Snap.rgb2hsl(r, g, b)

Converts RGB values to an HSL object
Top⇧
Snap.select(query)

Wraps a DOM element specified by CSS selector as Element
Top⇧
Snap.selectAll(query)

Wraps DOM elements specified by CSS selector as set or array of Element
Top⇧
Snap.set()

Creates a new Set object and fills it with list of arguments.
Top⇧
Snap.sin(angle)

Equivalent to Math.sin() only works with degrees, not radians.
Top⇧
Snap.snapTo(values, value, [tolerance])

values - array of values or step of the grid
value - value to adjust
tolerance - maximum distance to the target value that would trigger the snap. Default is 10.
Snaps given value to given grid
Top⇧
Snap.tan(angle)

Equivalent to Math.tan() only works with degrees, not radians.
Top⇧
Snap.url(value)

Wraps path into "url('<path>')".
Top⇧
mina(a, A, b, B, get, set, [easing])

a - start slave number
A - end slave number
b - start master number (start time in general case)
B - end master number (end time in general case)
get - getter function of master number (see mina.time)
set - setter function of slave number
easing - easing function, default is mina.linear
Generic animation of numbers
Top⇧
mina.backin(n)

n - input 0..1
Backin easing
Top⇧
mina.backout(n)

n - input 0..1
Backout easing
Top⇧
mina.bounce(n)

n - input 0..1
Bounce easing
Top⇧
mina.easein(n)

n - input 0..1
Easein easing
Top⇧
mina.easeinout(n)

n - input 0..1
Easeinout easing
Top⇧
mina.easeout(n)

n - input 0..1
Easeout easing
Top⇧
mina.elastic(n)

n - input 0..1
Elastic easing
Top⇧
mina.getById(id)

Returns an animation by its id
Top⇧
mina.linear(n)

n - input 0..1
Default linear easing
Top⇧
mina.time()

Returns the current time. Equivalent to: new Date.getTime();
Top⇧