code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
parseEaseString = (string, easesFunctions, easesLookups) => { if (easesLookups[string]) return easesLookups[string]; if (string.indexOf('(') <= -1) { const hasParams = easeTypes[string] || string.includes('Back') || string.includes('Elastic'); const parsedFn = /** @type {EasingFunction} ...
@param {String} string @param {Record<String, EasesFactory|EasingFunction>} easesFunctions @param {Object} easesLookups @return {EasingFunction}
parseEaseString
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
sanitizePropertyName = (propertyName, target, tweenType) => { if (tweenType === tweenTypes.TRANSFORM) { const t = shortTransforms.get(propertyName); return t ? t : propertyName; } else if (tweenType === tweenTypes.CSS || // Handle special cases where properties like "strokeDashoffset...
@param {String} propertyName @param {Target} target @param {tweenTypes} tweenType @return {String}
sanitizePropertyName
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
sanitizePropertyName = (propertyName, target, tweenType) => { if (tweenType === tweenTypes.TRANSFORM) { const t = shortTransforms.get(propertyName); return t ? t : propertyName; } else if (tweenType === tweenTypes.CSS || // Handle special cases where properties like "strokeDashoffset...
@param {String} propertyName @param {Target} target @param {tweenTypes} tweenType @return {String}
sanitizePropertyName
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
convertValueUnit = (el, decomposedValue, unit, force = false) => { const currentUnit = decomposedValue.u; const currentNumber = decomposedValue.n; if (decomposedValue.t === valueTypes.UNIT && currentUnit === unit) { // TODO: Check if checking against the same unit string is necessary return decompos...
@param {DOMTarget} el @param {TweenDecomposedValue} decomposedValue @param {String} unit @param {Boolean} [force] @return {TweenDecomposedValue}
convertValueUnit
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
convertValueUnit = (el, decomposedValue, unit, force = false) => { const currentUnit = decomposedValue.u; const currentNumber = decomposedValue.n; if (decomposedValue.t === valueTypes.UNIT && currentUnit === unit) { // TODO: Check if checking against the same unit string is necessary return decompos...
@param {DOMTarget} el @param {TweenDecomposedValue} decomposedValue @param {String} unit @param {Boolean} [force] @return {TweenDecomposedValue}
convertValueUnit
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
generateKeyframes = (keyframes, parameters) => { /** @type {AnimationParams} */ const properties = {}; if (isArr(keyframes)) { const propertyNames = [].concat(... /** @type {DurationKeyframes} */(keyframes).map(key => Object.keys(key))).filter(isKey); for (let i = 0, l = propertyNames.length...
@param {DurationKeyframes | PercentageKeyframes} keyframes @param {AnimationParams} parameters @return {AnimationParams}
generateKeyframes
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
generateKeyframes = (keyframes, parameters) => { /** @type {AnimationParams} */ const properties = {}; if (isArr(keyframes)) { const propertyNames = [].concat(... /** @type {DurationKeyframes} */(keyframes).map(key => Object.keys(key))).filter(isKey); for (let i = 0, l = propertyNames.length...
@param {DurationKeyframes | PercentageKeyframes} keyframes @param {AnimationParams} parameters @return {AnimationParams}
generateKeyframes
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
constructor(targets, parameters, parent, parentPosition, fastSet = false, index = 0, length = 0) { super(/** @type {TimerParams&AnimationParams} */ (parameters), parent, parentPosition); const parsedTargets = registerTargets(targets); const targetsLength = parsedTargets.length; // If the...
@param {TargetsParam} targets @param {AnimationParams} parameters @param {Timeline} [parent] @param {Number} [parentPosition] @param {Boolean} [fastSet=false] @param {Number} [index=0] @param {Number} [length=0]
constructor
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
revert() { super.revert(); return cleanInlineStyles(this); }
Cancel the animation and revert all the values affected by this animation to their original state @return {this}
revert
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
then(callback) { return super.then(callback); }
@param {Callback<this>} [callback] @return {Promise}
then
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
easingToLinear = (fn, samples = 100) => { const points = []; for (let i = 0; i <= samples; i++) points.push(fn(i / samples)); return `linear(${points.join(', ')})`; }
Converts an easing function into a valid CSS linear() timing function string @param {EasingFunction} fn @param {number} [samples=100] @returns {string} CSS linear() timing function
easingToLinear
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
easingToLinear = (fn, samples = 100) => { const points = []; for (let i = 0; i <= samples; i++) points.push(fn(i / samples)); return `linear(${points.join(', ')})`; }
Converts an easing function into a valid CSS linear() timing function string @param {EasingFunction} fn @param {number} [samples=100] @returns {string} CSS linear() timing function
easingToLinear
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
registerTransformsProperties = () => { if (transformsPropertiesRegistered) return; validTransforms.forEach(t => { const isSkew = stringStartsWith(t, 'skew'); const isScale = stringStartsWith(t, 'scale'); const isRotate = stringStartsWith(t, 'rotate'); const isTranslate = ...
@typedef {Record<String, WAAPIKeyframeValue | WAAPIAnimationOptions | Boolean | ScrollObserver | WAAPICallback | EasingParam | WAAPITweenOptions> & WAAPIAnimationOptions} WAAPIAnimationParams
registerTransformsProperties
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
registerTransformsProperties = () => { if (transformsPropertiesRegistered) return; validTransforms.forEach(t => { const isSkew = stringStartsWith(t, 'skew'); const isScale = stringStartsWith(t, 'scale'); const isRotate = stringStartsWith(t, 'rotate'); const isTranslate = ...
@typedef {Record<String, WAAPIKeyframeValue | WAAPIAnimationOptions | Boolean | ScrollObserver | WAAPICallback | EasingParam | WAAPITweenOptions> & WAAPIAnimationOptions} WAAPIAnimationParams
registerTransformsProperties
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
removeWAAPIAnimation = ($el, property, parent) => { let nextLookup = WAAPIAnimationsLookups._head; while (nextLookup) { const next = nextLookup._next; const matchTarget = nextLookup.$el === $el; const matchProperty = !property || nextLookup.property === property; const matchParen...
@param {DOMTarget} $el @param {String} [property] @param {WAAPIAnimation} [parent]
removeWAAPIAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
removeWAAPIAnimation = ($el, property, parent) => { let nextLookup = WAAPIAnimationsLookups._head; while (nextLookup) { const next = nextLookup._next; const matchTarget = nextLookup.$el === $el; const matchProperty = !property || nextLookup.property === property; const matchParen...
@param {DOMTarget} $el @param {String} [property] @param {WAAPIAnimation} [parent]
removeWAAPIAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
addWAAPIAnimation = (parent, $el, property, keyframes, params) => { const animation = $el.animate(keyframes, params); const animTotalDuration = params.delay + (+params.duration * params.iterations); animation.playbackRate = parent._speed; if (parent.paused) animation.pause(); if (parent.dura...
@param {WAAPIAnimation} parent @param {DOMTarget} $el @param {String} property @param {PropertyIndexedKeyframes} keyframes @param {KeyframeAnimationOptions} params @retun {Animation}
addWAAPIAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
addWAAPIAnimation = (parent, $el, property, keyframes, params) => { const animation = $el.animate(keyframes, params); const animTotalDuration = params.delay + (+params.duration * params.iterations); animation.playbackRate = parent._speed; if (parent.paused) animation.pause(); if (parent.dura...
@param {WAAPIAnimation} parent @param {DOMTarget} $el @param {String} property @param {PropertyIndexedKeyframes} keyframes @param {KeyframeAnimationOptions} params @retun {Animation}
addWAAPIAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
normalizeTweenValue = (propName, value, $el, i, targetsLength) => { let v = getFunctionValue(/** @type {any} */ (value), $el, i, targetsLength); if (!isNum(v)) return v; if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`; if (stri...
@param {String} propName @param {WAAPIKeyframeValue} value @param {DOMTarget} $el @param {Number} i @param {Number} targetsLength @return {String}
normalizeTweenValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
normalizeTweenValue = (propName, value, $el, i, targetsLength) => { let v = getFunctionValue(/** @type {any} */ (value), $el, i, targetsLength); if (!isNum(v)) return v; if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`; if (stri...
@param {String} propName @param {WAAPIKeyframeValue} value @param {DOMTarget} $el @param {Number} i @param {Number} targetsLength @return {String}
normalizeTweenValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => { /** @type {WAAPITweenValue} */ let tweenValue = '0'; const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName]; if (!isUnd(from)) { const computedFrom = n...
@param {DOMTarget} $el @param {String} propName @param {WAAPIKeyframeValue} from @param {WAAPIKeyframeValue} to @param {Number} i @param {Number} targetsLength @return {WAAPITweenValue}
parseIndividualTweenValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => { /** @type {WAAPITweenValue} */ let tweenValue = '0'; const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName]; if (!isUnd(from)) { const computedFrom = n...
@param {DOMTarget} $el @param {String} propName @param {WAAPIKeyframeValue} from @param {WAAPIKeyframeValue} to @param {Number} i @param {Number} targetsLength @return {WAAPITweenValue}
parseIndividualTweenValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
constructor(targets, params) { if (globals.scope) globals.scope.revertibles.push(this); registerTransformsProperties(); const parsedTargets = registerTargets(targets); const targetsLength = parsedTargets.length; if (!targetsLength) { console.warn(`No targe...
@param {DOMTargetsParam} targets @param {WAAPIAnimationParams} params
constructor
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
forEach(callback) { const cb = isStr(callback) ? a => a[callback]() : callback; this.animations.forEach(cb); return this; }
@param {forEachCallback|String} callback @return {this}
forEach
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
get speed() { return this._speed; }
@param {forEachCallback|String} callback @return {this}
speed
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
seek(time, muteCallbacks = false) { if (muteCallbacks) this.muteCallbacks = true; if (time < this.duration) this.completed = false; this.currentTime = time; this.muteCallbacks = false; if (this.paused) this.pause(); return this; }
@param {Number} time @param {Boolean} muteCallbacks
seek
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
restart() { this.completed = false; return this.seek(0, true).resume(); }
@param {Number} time @param {Boolean} muteCallbacks
restart
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
commitStyles() { return this.forEach('commitStyles'); }
@param {Number} time @param {Boolean} muteCallbacks
commitStyles
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
complete() { return this.seek(this.duration); }
@param {Number} time @param {Boolean} muteCallbacks
complete
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
cancel() { this.forEach('cancel'); return this.pause(); }
@param {Number} time @param {Boolean} muteCallbacks
cancel
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
revert() { this.cancel(); this.targets.forEach(($el, i) => $el.setAttribute('style', this._inlineStyles[i])); return this; }
@param {Number} time @param {Boolean} muteCallbacks
revert
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
sync = (callback = noop) => { return new Timer({ duration: 1 * globals.timeScale, onComplete: callback }, null, 0).resume(); }
@param {Callback<Timer>} [callback] @return {Timer}
sync
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
sync = (callback = noop) => { return new Timer({ duration: 1 * globals.timeScale, onComplete: callback }, null, 0).resume(); }
@param {Callback<Timer>} [callback] @return {Timer}
sync
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
function getTargetValue(targetSelector, propName, unit) { const targets = registerTargets(targetSelector); if (!targets.length) return; const [target] = targets; const tweenType = getTweenType(target, propName); const normalizePropName = sanitizePropertyName(propName, target, tweenType); ...
@overload @param {DOMTargetSelector} targetSelector @param {String} propName @return {String} @overload @param {JSTargetsParam} targetSelector @param {String} propName @return {Number|String} @overload @param {DOMTargetsParam} targetSelector @param {String} propName @param {String} ...
getTargetValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
setTargetValues = (targets, parameters) => { if (isUnd(parameters)) return; parameters.duration = minValue; // Do not overrides currently active tweens by default parameters.composition = setValue(parameters.composition, compositionTypes.none); // Skip init() and force rendering by playing t...
@param {TargetsParam} targets @param {AnimationParams} parameters @return {JSAnimation}
setTargetValues
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
setTargetValues = (targets, parameters) => { if (isUnd(parameters)) return; parameters.duration = minValue; // Do not overrides currently active tweens by default parameters.composition = setValue(parameters.composition, compositionTypes.none); // Skip init() and force rendering by playing t...
@param {TargetsParam} targets @param {AnimationParams} parameters @return {JSAnimation}
setTargetValues
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
removeTargetsFromAnimation = (targetsArray, animation, propertyName) => { let tweensMatchesTargets = false; forEachChildren(animation, (/**@type {Tween} */ tween) => { const tweenTarget = tween.target; if (targetsArray.includes(tweenTarget)) { const tweenName = tween.property; ...
@param {TargetsArray} targetsArray @param {JSAnimation} animation @param {String} [propertyName] @return {Boolean}
removeTargetsFromAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
removeTargetsFromAnimation = (targetsArray, animation, propertyName) => { let tweensMatchesTargets = false; forEachChildren(animation, (/**@type {Tween} */ tween) => { const tweenTarget = tween.target; if (targetsArray.includes(tweenTarget)) { const tweenName = tween.property; ...
@param {TargetsArray} targetsArray @param {JSAnimation} animation @param {String} [propertyName] @return {Boolean}
removeTargetsFromAnimation
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
remove = (targets, renderable, propertyName) => { const targetsArray = parseTargets(targets); const parent = /** @type {Renderable|typeof engine} **/ (renderable ? renderable : engine); const waapiAnimation = renderable && /** @type {WAAPIAnimation} */ (renderable).controlAnimation && /** @type {WAAPIAnimat...
@param {TargetsParam} targets @param {Renderable|WAAPIAnimation} [renderable] @param {String} [propertyName] @return {TargetsArray}
remove
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
remove = (targets, renderable, propertyName) => { const targetsArray = parseTargets(targets); const parent = /** @type {Renderable|typeof engine} **/ (renderable ? renderable : engine); const waapiAnimation = renderable && /** @type {WAAPIAnimation} */ (renderable).controlAnimation && /** @type {WAAPIAnimat...
@param {TargetsParam} targets @param {Renderable|WAAPIAnimation} [renderable] @param {String} [propertyName] @return {TargetsArray}
remove
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
shuffle = items => { let m = items.length, t, i; while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; } return items; }
Adapted from https://bost.ocks.org/mike/shuffle/ @param {Array} items @return {Array}
shuffle
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
shuffle = items => { let m = items.length, t, i; while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; } return items; }
Adapted from https://bost.ocks.org/mike/shuffle/ @param {Array} items @return {Array}
shuffle
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
lerp = (start, end, amount, renderable) => { let dt = K / globals.defaults.frameRate; if (renderable !== false) { const ticker = /** @type Renderable */ (renderable) || (engine._hasChildren && engine); if (ticker && ticker.deltaTime) { dt = ticker.deltaTime; } ...
https://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ @param {Number} start @param {Number} end @param {Number} amount @param {Renderable|Boolean} [renderable] @return {Number}
lerp
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
lerp = (start, end, amount, renderable) => { let dt = K / globals.defaults.frameRate; if (renderable !== false) { const ticker = /** @type Renderable */ (renderable) || (engine._hasChildren && engine); if (ticker && ticker.deltaTime) { dt = ticker.deltaTime; } ...
https://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ @param {Number} start @param {Number} end @param {Number} amount @param {Renderable|Boolean} [renderable] @return {Number}
lerp
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
chain = fn => { return (...args) => { const result = fn(...args); return new Proxy(noop, { apply: (_, __, [v]) => result(v), get: (_, prop) => chain(/**@param {...Number|String} nextArgs */ (...nextArgs) => { const nextResult = utils[prop](...nextArgs); ...
@param {Function} fn @return {function(...(Number|String))}
chain
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
chain = fn => { return (...args) => { const result = fn(...args); return new Proxy(noop, { apply: (_, __, [v]) => result(v), get: (_, prop) => chain(/**@param {...Number|String} nextArgs */ (...nextArgs) => { const nextResult = utils[prop](...nextArgs); ...
@param {Function} fn @return {function(...(Number|String))}
chain
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
getPrevChildOffset = (timeline, timePosition) => { if (stringStartsWith(timePosition, '<')) { const goToPrevAnimationOffset = timePosition[1] === '<'; const prevAnimation = /** @type {Tickable} */ (timeline._tail); const prevOffset = prevAnimation ? prevAnimation._offset + prevAnimation._del...
Timeline's children offsets positions parser @param {Timeline} timeline @param {String} timePosition @return {Number}
getPrevChildOffset
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
getPrevChildOffset = (timeline, timePosition) => { if (stringStartsWith(timePosition, '<')) { const goToPrevAnimationOffset = timePosition[1] === '<'; const prevAnimation = /** @type {Tickable} */ (timeline._tail); const prevOffset = prevAnimation ? prevAnimation._offset + prevAnimation._del...
Timeline's children offsets positions parser @param {Timeline} timeline @param {String} timePosition @return {Number}
getPrevChildOffset
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseTimelinePosition = (timeline, timePosition) => { let tlDuration = timeline.iterationDuration; if (tlDuration === minValue) tlDuration = 0; if (isUnd(timePosition)) return tlDuration; if (isNum(+timePosition)) return +timePosition; const timePosStr = /** @type {String} */...
@param {Timeline} timeline @param {TimePosition} [timePosition] @return {Number}
parseTimelinePosition
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseTimelinePosition = (timeline, timePosition) => { let tlDuration = timeline.iterationDuration; if (tlDuration === minValue) tlDuration = 0; if (isUnd(timePosition)) return tlDuration; if (isNum(+timePosition)) return +timePosition; const timePosStr = /** @type {String} */...
@param {Timeline} timeline @param {TimePosition} [timePosition] @return {Number}
parseTimelinePosition
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
function addTlChild(childParams, tl, timePosition, targets, index, length) { const isSetter = isNum(childParams.duration) && /** @type {Number} */ (childParams.duration) <= minValue; // Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the def...
@overload @param {TimerParams} childParams @param {Timeline} tl @param {Number} timePosition @return {Timeline} @overload @param {AnimationParams} childParams @param {Timeline} tl @param {Number} timePosition @param {TargetsParam} targets @param {Number} [index] @param {Number} [length] @return {Timeline} @p...
addTlChild
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
add(a1, a2, a3) { const isAnim = isObj(a2); const isTimer = isObj(a1); if (isAnim || isTimer) { this._hasChildren = true; if (isAnim) { const childParams = /** @type {AnimationParams} */ (a2); // Check for function for children stagger posi...
@overload @param {TargetsParam} a1 @param {AnimationParams} a2 @param {TimePosition} [a3] @return {this} @overload @param {TimerParams} a1 @param {TimePosition} [a2] @return {this} @param {TargetsParam|TimerParams} a1 @param {AnimationParams|TimePosition} a2 @param {TimePosition} [a3]
add
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
sync(synced, position) { if (isUnd(synced) || synced && isUnd(synced.pause)) return this; synced.pause(); const duration = +( /** @type {globalThis.Animation} */(synced).effect ? /** @type {globalThis.Animation} */ (synced).effect.getTiming().duration : /** @type {Tickable} */ (synce...
@overload @param {Tickable} [synced] @param {TimePosition} [position] @return {this} @overload @param {globalThis.Animation} [synced] @param {TimePosition} [position] @return {this} @overload @param {WAAPIAnimation} [synced] @param {TimePosition} [position] @return {this} @param {Tickable|WAAPIAnimation|globalThis.A...
sync
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
set(targets, parameters, position) { if (isUnd(parameters)) return this; parameters.duration = minValue; parameters.composition = compositionTypes.replace; return this.add(targets, parameters, position); }
@param {TargetsParam} targets @param {AnimationParams} parameters @param {TimePosition} [position] @return {this}
set
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
call(callback, position) { if (isUnd(callback) || callback && !isFnc(callback)) return this; return this.add({ duration: 0, onComplete: () => callback(this) }, position); }
@param {Callback<Timer>} callback @param {TimePosition} [position] @return {this}
call
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
label(labelName, position) { if (isUnd(labelName) || labelName && !isStr(labelName)) return this; this.labels[labelName] = parseTimelinePosition(this, /** @type TimePosition */ (position)); return this; }
@param {String} labelName @param {TimePosition} [position] @return {this}
label
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
remove(targets, propertyName) { remove(targets, this, propertyName); return this; }
@param {TargetsParam} targets @param {String} [propertyName] @return {this}
remove
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
then(callback) { return super.then(callback); }
@param {Callback<this>} [callback] @return {Promise}
then
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
constructor(targets, parameters) { if (globals.scope) globals.scope.revertibles.push(this); /** @type {AnimationParams} */ const globalParams = {}; const properties = {}; this.targets = []; this.animations = {}; if (isUnd(targets) || isUnd(parameters))...
@param {TargetsParam} targets @param {AnimatableParams} parameters
constructor
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
normalizePoint(x, y) { this.point.x = x; this.point.y = y; return this.point.matrixTransform(this.inversedMatrix); }
@param {Number} x @param {Number} y @return {DOMPoint}
normalizePoint
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
constructor(target, parameters = {}) { if (!target) return; if (globals.scope) globals.scope.revertibles.push(this); const paramX = parameters.x; const paramY = parameters.y; const trigger = parameters.trigger; const modifier = parameters.modifier;...
@param {TargetsParam} target @param {DraggableParams} [parameters]
constructor
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
computeVelocity(dx, dy) { const prevTime = this.velocityTime; const curTime = now(); const elapsed = curTime - prevTime; if (elapsed < 17) return this.velocity; this.velocityTime = curTime; const velocityStack = this.velocityStack; const vMul = this.ve...
@param {Number} dx @param {Number} dy @return {Number}
computeVelocity
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
setX(x, muteUpdateCallback = false) { if (this.disabled[0]) return; const v = round(x, 5); this.overshootXTicker.pause(); this.manual = true; this.updated = !muteUpdateCallback; this.destX = v; this.snapped[0] = snap(v, this.snapX); this.animat...
@param {Number} x @param {Boolean} [muteUpdateCallback] @return {this}
setX
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
setY(y, muteUpdateCallback = false) { if (this.disabled[1]) return; const v = round(y, 5); this.overshootYTicker.pause(); this.manual = true; this.updated = !muteUpdateCallback; this.destY = v; this.snapped[1] = snap(v, this.snapY); this.animat...
@param {Number} y @param {Boolean} [muteUpdateCallback] @return {this}
setY
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
get x() { return round(/** @type {Number} */ (this.animate[this.xProp]()), globals.precision); }
@param {Number} y @param {Boolean} [muteUpdateCallback] @return {this}
x
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
isOutOfBounds(bounds, x, y) { if (!this.contained) return 0; const [bt, br, bb, bl] = bounds; const [dx, dy] = this.disabled; const obx = !dx && x < bl || !dx && x > br; const oby = !dy && y < bt || !dy && y > bb; return obx && !oby ? 1 : !obx && oby ? 2 : obx...
Returns 0 if not OB, 1 if x is OB, 2 if y is OB, 3 if both x and y are OB @param {Array} bounds @param {Number} x @param {Number} y @return {Number}
isOutOfBounds
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
refresh() { const params = this.parameters; const paramX = params.x; const paramY = params.y; const container = parseDraggableFunctionParameter(params.container, this); const cp = parseDraggableFunctionParameter(params.containerPadding, this) || 0; const containerPadding ...
Returns 0 if not OB, 1 if x is OB, 2 if y is OB, 3 if both x and y are OB @param {Array} bounds @param {Number} x @param {Number} y @return {Number}
refresh
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
scrollInView(duration, gap = 0, ease = eases.inOutQuad) { this.updateScrollCoords(); const x = this.destX; const y = this.destY; const scroll = this.scroll; const scrollBounds = this.scrollBounds; const canScroll = this.canScroll; if (!this.containerArray && this....
@param {Number} [duration] @param {Number} [gap] @param {EasingParam} [ease] @return {this}
scrollInView
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
handleHover() { if (this.isFinePointer && this.cursor && !this.cursorStyles) { this.cursorStyles = setTargetValues(this.$trigger, { cursor: /** @type {DraggableCursorParams} */ (this.cursor).onHover }); } }
@param {Number} [duration] @param {Number} [gap] @param {EasingParam} [ease] @return {this}
handleHover
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
animateInView(duration, gap = 0, ease = eases.inOutQuad) { this.stop(); this.updateBoundingValues(); const x = this.x; const y = this.y; const [cpt, cpr, cpb, cpl] = this.containerPadding; const bt = this.scroll.y - this.targetBounds[0] + cpt + gap; const br = thi...
@param {Number} [duration] @param {Number} [gap] @param {EasingParam} [ease] @return {this}
animateInView
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
execute(cb) { let activeScope = globals.scope; let activeRoot = globals.root; let activeDefaults = globals.defaults; globals.scope = this; globals.root = this.root; globals.defaults = this.defaults; const mqs = this.mediaQueryLists; for (let mq in mqs) ...
@callback ScoppedCallback @param {this} scope @return {any} @param {ScoppedCallback} cb @return {this}
execute
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
add(a1, a2) { if (isFnc(a1)) { const constructor = /** @type {contructorCallback} */ (a1); this.constructors.push(constructor); this.execute(() => { const revertConstructor = constructor(this); if (revertConstructor) { this....
@callback contructorCallback @param {this} self @overload @param {String} a1 @param {ScopeMethod} a2 @return {this} @overload @param {contructorCallback} a1 @return {this} @param {String|contructorCallback} a1 @param {ScopeMethod} [a2]
add
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
convertValueToPx = ($el, v, size, under, over) => { const clampMin = v === 'min'; const clampMax = v === 'max'; const value = v === 'top' || v === 'left' || v === 'start' || clampMin ? 0 : v === 'bottom' || v === 'right' || v === 'end' || clampMax ? '100%' : v === 'center' ? '50%' : ...
@param {HTMLElement} $el @param {Number|string} v @param {Number} size @param {Number} [under] @param {Number} [over] @return {Number}
convertValueToPx
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
convertValueToPx = ($el, v, size, under, over) => { const clampMin = v === 'min'; const clampMax = v === 'max'; const value = v === 'top' || v === 'left' || v === 'start' || clampMin ? 0 : v === 'bottom' || v === 'right' || v === 'end' || clampMax ? '100%' : v === 'center' ? '50%' : ...
@param {HTMLElement} $el @param {Number|string} v @param {Number} size @param {Number} [under] @param {Number} [over] @return {Number}
convertValueToPx
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseBoundValue = ($el, v, size, under, over) => { /** @type {Number} */ let value; if (isStr(v)) { const matchedOperator = relativeValuesExecRgx.exec(/** @type {String} */ (v)); if (matchedOperator) { const splitter = matchedOperator[0]; const operator = splitter[0];...
@param {HTMLElement} $el @param {ScrollThresholdValue} v @param {Number} size @param {Number} [under] @param {Number} [over] @return {Number}
parseBoundValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
parseBoundValue = ($el, v, size, under, over) => { /** @type {Number} */ let value; if (isStr(v)) { const matchedOperator = relativeValuesExecRgx.exec(/** @type {String} */ (v)); if (matchedOperator) { const splitter = matchedOperator[0]; const operator = splitter[0];...
@param {HTMLElement} $el @param {ScrollThresholdValue} v @param {Number} size @param {Number} [under] @param {Number} [over] @return {Number}
parseBoundValue
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
updateBounds() { if (this._debug) { this.removeDebug(); } let stickys; const $target = this.target; const container = this.container; const isHori = this.horizontal; const linked = this.linked; let linkedTime; let $el = $target; ...
@param {String} p @param {Number} l @param {Number} t @param {Number} w @param {Number} h @return {String}
updateBounds
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
stagger = (val, params = {}) => { let values = []; let maxValue = 0; const from = params.from; const reversed = params.reversed; const ease = params.ease; const hasEasing = !isUnd(ease); const hasSpring = hasEasing && !isUnd(/** @type {Spring} */ (ease).ease); const staggerEase = hasSpri...
@param {Number|String|[Number|String,Number|String]} val @param {StaggerParameters} params @return {StaggerFunction}
stagger
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
stagger = (val, params = {}) => { let values = []; let maxValue = 0; const from = params.from; const reversed = params.reversed; const ease = params.ease; const hasEasing = !isUnd(ease); const hasSpring = hasEasing && !isUnd(/** @type {Spring} */ (ease).ease); const staggerEase = hasSpri...
@param {Number|String|[Number|String,Number|String]} val @param {StaggerParameters} params @return {StaggerFunction}
stagger
javascript
juliangarnier/anime
types/index.js
https://github.com/juliangarnier/anime/blob/master/types/index.js
MIT
function markFunction( fn ) { fn[ expando ] = true; return fn; }
Mark a function for special use by Sizzle @param {Function} fn The function to mark
markFunction
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } }
Support testing using an element @param {Function} fn Passed the created div and expects a boolean result
assert
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = attrs.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } }
Adds the same handler for all of the specified attrs @param {String} attrs Pipe-separated list of attributes @param {Function} handler The method that will be applied
addHandle
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( ...
Checks document order of two siblings @param {Element} a @param {Element} b @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
siblingCheck
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; }
Returns a function to use in pseudos for input types @param {String} type
createInputPseudo
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; }
Returns a function to use in pseudos for buttons @param {String} type
createButtonPseudo
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) {...
Returns a function to use in pseudos for positionals @param {Function} fn
createPositionalPseudo
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function testContext( context ) { return context && typeof context.getElementsByTagName !== strundefined && context; }
Checks a node for validity as a Sizzle context @param {Element|Object=} context @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
testContext
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first r...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
tokenize
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
toSelector
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem....
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
addCombinator
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
elementMatcher
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { m...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
condense
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( s...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
setMatcher
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level c...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
matcherFromTokens
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched ...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
matcherFromGroupMatchers
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Exp...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
superMatcher
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
multipleContexts
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0]...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
select
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( e...
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
winnow
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT
function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
sibling
javascript
documentcloud/visualsearch
build/dependencies.js
https://github.com/documentcloud/visualsearch/blob/master/build/dependencies.js
MIT