Skip to content

Modules

js-css-animations.js

Builds the animation API that will be exported to the final user

jsCssAnimations : Object.<string, (function()|Object)>

An API encapsulating all the functions that can be used by the user, like all the animations functions and auxiliary functions like: isTransformed(), isVisible() and isHidden()

Kind: inner constant of js-css-animations

config(opts)

Default values used by all animations are set by the user by overriding default animations properties and options

Kind: inner method of js-css-animations
See

ParamTypeDescription
optsObjectAll custom animation properties and options.

reset()

Resets default animations values by removing default values customized by the user

Kind: inner method of js-css-animations

animationFunctions : Object

An object containing all the animations functions.

Visibility animations functions are under animationFunctions.hide and animationFunctions.show

All other keys of animationFunctions are Motion animations functions

Kind: inner constant of js-css-animations

See:

eventBoundAnimations : Object.<string, function()>

An object containing animations functions wich are triggered by an event (like 'click')

Kind: inner constant of js-css-animations

verifyAnimationName : ProxyHandler

Will throw an ReferenceError if the animation name does not corresponds to any animation function

Kind: inner constant of js-css-animations

verifyAnimationName.get(animations, name)

Kind: static method of verifyAnimationName

ParamTypeDescription
animationsObject.<string, function()>Object containing animation functions
namestringName of the animation

selectElement(selector) ⇒ HTMLElement

If 'selector' is a string containing a valid CSS selector, it will be used to perform a querySelector(), If 'selector' is already an HTMLElement it will be returned as it is.

Kind: inner method of js-css-animations

Returns: An HTMLElement

ParamTypeDescription
selectorElement | stringIf it's an HTMLElement, 'selector' will be returned as it is. If it's a string, it should be a valid CSS selector

selectAllElements(selector) ⇒ NodeList.<Element>

Returns a NodeList with all elements that match 'selector'

Kind: inner method of js-css-animations

Returns: A NodeList containing all elements matched by the 'selector'

ParamTypeDescription
selectorstringA valid CSS selector to be passed to querySelectorAll()

getTargets(selector) ⇒ NodeList.<Element> | Array.<HTMLElement>

Gets the element(s) to be animated. The user can pass either an HTMLElement or a CSS selector as a target to the animation

Kind: inner method of js-css-animations

Returns: An array containing a single HTMLElement or a NodeList with all the elements matching the CSS selector in 'selector'

ParamTypeDescription
selectorHTMLElement | stringAn HTMLElement or a valid CSS selector to be passed to querySelectorAll()

toggle(selector, animA, animB, opts)

Toggles between two animations.

If 'animA' and 'animB' have the same name, it will toggle between the 'hide' state and the 'show' state, although this is only applicable to visibility animations.

Kind: inner method of js-css-animations

See: globals.VISIBILITY_ANIMS_ID

ParamTypeDescription
selectorHTMLElement | stringThe DOM element or a valid CSS selector with the element(s) to be animated
animAstringThe initial animation name
animBstringThe next animation name
optsObject | ObjectAll options that can be passed by the user to customize the animation

toggle~element

The current animation attribute will only be set in the first element that matches the 'selector' passed, but the animation will apply to all elements matched by 'selector'

Kind: inner constant of toggle

isTransformed(selector) ⇒ boolean

Verifies if an element is out of its original orientation or scale.

Note that if the element has CSS property 'transform: rotate(0deg)', isTransformed() will still return False, as the element is not out of its original orientation.

Kind: inner method of js-css-animations

Returns: True if the element was rotated from its original orientation. False if it maintains the original orientation.

ParamTypeDescription
selectorHTMLElement | stringAn element or a valid CSS selector corresponding to the element

checkVisibility(selector, mode) ⇒ boolean

Verifies if a given element is hidden or visible

Kind: inner method of js-css-animations

Returns: boolean - True or False depending if the element is visible or hidden, according to the 'mode' passed

ParamTypeDescription
selectorElement | stringAn element or a valid CSS selector corresponding to the element
modestringEither 'visible' or 'hidden'

isVisible(selector) ⇒ boolean

Kind: inner method of js-css-animations

Returns: True if the element is visible, False otherwise

ParamTypeDescription
selectorElement | stringDom element or a valid CSS selector

isHidden(selector) ⇒ boolean

Kind: inner method of js-css-animations

Returns: True if the element is hidden, False otherwise

ParamTypeDescription
selectorElement | stringDom element or a valid CSS selector