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 |
|---|---|---|---|---|---|---|---|
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];
const splitted = /**... | @param {HTMLElement} $el
@param {ScrollThresholdValue} v
@param {Number} size
@param {Number} [under]
@param {Number} [over]
@return {Number} | parseBoundValue | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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];
const splitted = /**... | @param {HTMLElement} $el
@param {ScrollThresholdValue} v
@param {Number} size
@param {Number} [under]
@param {Number} [over]
@return {Number} | parseBoundValue | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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;
let offsetX = 0;
let offsetY = 0;
/**... | @param {String} p
@param {Number} l
@param {Number} t
@param {Number} w
@param {Number} h
@return {String} | updateBounds | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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)) return;
for (let propName in parame... | @param {TargetsParam} targets
@param {AnimatableParams} parameters | constructor | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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;
const ease = parameters.releaseEase;
co... | @param {TargetsParam} target
@param {DraggableParams} [parameters] | constructor | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js | MIT |
setX(x, muteUpdateCallback = false) {
if (this.disabled[0]) return;
const v = round(x, 5);
this.manual = true;
this.updated = !muteUpdateCallback;
this.destX = v;
this.snapped[0] = snap(v, this.snapX);
this.animate[this.xProp](v, 0);
this.manual = false;
return this;
} | @param {Number} x
@param {Boolean} [muteUpdateCallback]
@return {this} | setX | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js | MIT |
setY(y, muteUpdateCallback = false) {
if (this.disabled[1]) return;
const v = round(y, 5);
this.manual = true;
this.updated = !muteUpdateCallback;
this.destY = v;
this.snapped[1] = snap(v, this.snapY);
this.animate[this.yProp](v, 0);
this.manual = false;
return this;
} | @param {Number} y
@param {Boolean} [muteUpdateCallback]
@return {this} | setY | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 && oby ? 3 : 0;
} | 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 | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 = /** @type {[Number, Nu... | 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 | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js | MIT |
scrollInView(duration, gap = 0, ease = eases.inOutQuad) {
// this.stop();
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.isOutOfB... | @param {Number} [duration]
@param {Number} [gap]
@param {EasingParam} [ease]
@return {this} | scrollInView | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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 = this.scroll.x - this.targetBo... | @param {Number} [duration]
@param {Number} [gap]
@param {EasingParam} [ease]
@return {this} | animateInView | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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) this.matches[mq] = mqs[mq].matches;... | @callback ScoppedCallback
@param {this} scope
@return {any}
@param {ScoppedCallback} cb
@return {this} | execute | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.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.revertConstructors.push(revertConstructor);
... | @callback contructorCallback
@param {this} self
@overload
@param {String} a1
@param {Function} a2
@return {this}
@overload
@param {contructorCallback} a1
@return {this}
@param {String|contructorCallback} a1
@param {Function} [a2] | add | javascript | juliangarnier/anime | tests/playground/assets/js/anime.esm.js | https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js | MIT |
parseNumber = str => isStr(str) ?
parseFloat(/** @type {String} */ (str)) :
/** @type {Number} */ (str) | @param {Number|String} str
@return {Number} | parseNumber | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
parseNumber = str => isStr(str) ?
parseFloat(/** @type {String} */ (str)) :
/** @type {Number} */ (str) | @param {Number|String} str
@return {Number} | parseNumber | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
round = (v, decimalLength) => {
if (decimalLength < 0)
return v;
if (!decimalLength)
return _round(v);
let p = powCache[decimalLength];
if (!p)
p = powCache[decimalLength] = 10 ** decimalLength;
return _round(v * p) / p;
} | @param {Number} v
@param {Number} decimalLength
@return {Number} | round | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
round = (v, decimalLength) => {
if (decimalLength < 0)
return v;
if (!decimalLength)
return _round(v);
let p = powCache[decimalLength];
if (!p)
p = powCache[decimalLength] = 10 ** decimalLength;
return _round(v * p) / p;
} | @param {Number} v
@param {Number} decimalLength
@return {Number} | round | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
forEachChildren = (parent, callback, reverse, prevProp = '_prev', nextProp = '_next') => {
let next = parent._head;
let adjustedNextProp = nextProp;
if (reverse) {
next = parent._tail;
adjustedNextProp = prevProp;
}
while (next) {
const currentNext = next[adjustedNextProp];
... | @param {Object} parent
@param {Function} callback
@param {Boolean} [reverse]
@param {String} [prevProp]
@param {String} [nextProp]
@return {void} | forEachChildren | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
forEachChildren = (parent, callback, reverse, prevProp = '_prev', nextProp = '_next') => {
let next = parent._head;
let adjustedNextProp = nextProp;
if (reverse) {
next = parent._tail;
adjustedNextProp = prevProp;
}
while (next) {
const currentNext = next[adjustedNextProp];
... | @param {Object} parent
@param {Function} callback
@param {Boolean} [reverse]
@param {String} [prevProp]
@param {String} [nextProp]
@return {void} | forEachChildren | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
removeChild = (parent, child, prevProp = '_prev', nextProp = '_next') => {
const prev = child[prevProp];
const next = child[nextProp];
prev ? prev[nextProp] = next : parent._head = next;
next ? next[prevProp] = prev : parent._tail = prev;
child[prevProp] = null;
child[nextProp] = null;
} | @param {Object} parent
@param {Object} child
@param {String} [prevProp]
@param {String} [nextProp]
@return {void} | removeChild | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
removeChild = (parent, child, prevProp = '_prev', nextProp = '_next') => {
const prev = child[prevProp];
const next = child[nextProp];
prev ? prev[nextProp] = next : parent._head = next;
next ? next[prevProp] = prev : parent._tail = prev;
child[prevProp] = null;
child[nextProp] = null;
} | @param {Object} parent
@param {Object} child
@param {String} [prevProp]
@param {String} [nextProp]
@return {void} | removeChild | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_next') => {
let prev = parent._tail;
while (prev && sortMethod && sortMethod(prev, child))
prev = prev[prevProp];
const next = prev ? prev[nextProp] : parent._head;
prev ? prev[nextProp] = child : parent._head = child;
n... | @param {Object} parent
@param {Object} child
@param {Function} [sortMethod]
@param {String} prevProp
@param {String} nextProp
@return {void} | addChild | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_next') => {
let prev = parent._tail;
while (prev && sortMethod && sortMethod(prev, child))
prev = prev[prevProp];
const next = prev ? prev[nextProp] : parent._head;
prev ? prev[nextProp] = child : parent._head = child;
n... | @param {Object} parent
@param {Object} child
@param {Function} [sortMethod]
@param {String} prevProp
@param {String} nextProp
@return {void} | addChild | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
const parent = tickable.parent;
const duration = tickable.duration;
const completed = tickable.completed;
const iterationDuration = tickable.iterationDuration;
const iterationCount = tickable.iterationCount;
const _currentIt... | @param {Tickable} tickable
@param {Number} time
@param {Number} muteCallbacks
@param {Number} internalRender
@param {tickModes} tickMode
@return {Number} | render | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
const parent = tickable.parent;
const duration = tickable.duration;
const completed = tickable.completed;
const iterationDuration = tickable.iterationDuration;
const iterationCount = tickable.iterationCount;
const _currentIt... | @param {Tickable} tickable
@param {Number} time
@param {Number} muteCallbacks
@param {Number} internalRender
@param {tickModes} tickMode
@return {Number} | render | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {
const _currentIteration = tickable._currentIteration;
render(tickable, time, muteCallbacks, internalRender, tickMode);
if (tickable._hasChildren) {
const tl = /** @type {Timeline} */ (tickable);
const tlIsRunningBackwards ... | @param {Tickable} tickable
@param {Number} time
@param {Number} muteCallbacks
@param {Number} internalRender
@param {Number} tickMode
@return {void} | tick | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {
const _currentIteration = tickable._currentIteration;
render(tickable, time, muteCallbacks, internalRender, tickMode);
if (tickable._hasChildren) {
const tl = /** @type {Timeline} */ (tickable);
const tlIsRunningBackwards ... | @param {Tickable} tickable
@param {Number} time
@param {Number} muteCallbacks
@param {Number} internalRender
@param {Number} tickMode
@return {void} | tick | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
parseInlineTransforms = (target, propName, animationInlineStyles) => {
const inlineTransforms = target.style.transform;
let inlinedStylesPropertyValue;
if (inlineTransforms) {
const cachedTransforms = target[transformsSymbol];
let t;
while (t = transformsExecRgx.exec(inlineTransforms... | @param {DOMTarget} target
@param {String} propName
@param {Object} animationInlineStyles
@return {String} | parseInlineTransforms | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
parseInlineTransforms = (target, propName, animationInlineStyles) => {
const inlineTransforms = target.style.transform;
let inlinedStylesPropertyValue;
if (inlineTransforms) {
const cachedTransforms = target[transformsSymbol];
let t;
while (t = transformsExecRgx.exec(inlineTransforms... | @param {DOMTarget} target
@param {String} propName
@param {Object} animationInlineStyles
@return {String} | parseInlineTransforms | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
function getNodeList(v) {
const n = isStr(v) ? globals.root.querySelectorAll(v) : v;
if (n instanceof NodeList || n instanceof HTMLCollection)
return n;
} | @param {DOMTargetsParam|TargetsParam} v
@return {NodeList|HTMLCollection} | getNodeList | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
function parseTargets(targets) {
if (isNil(targets))
return /** @type {TargetsArray} */ ([]);
if (isArr(targets)) {
const flattened = targets.flat(Infinity);
/** @type {TargetsArray} */
const parsed = [];
for (let i = 0, l = flattened.length; i < l; i++) {
con... | @overload
@param {DOMTargetsParam} targets
@return {DOMTargetsArray}
@overload
@param {JSTargetsParam} targets
@return {JSTargetsArray}
@overload
@param {TargetsParam} targets
@return {TargetsArray}
@param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets | parseTargets | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
function registerTargets(targets) {
const parsedTargetsArray = parseTargets(targets);
const parsedTargetsLength = parsedTargetsArray.length;
if (parsedTargetsLength) {
for (let i = 0; i < parsedTargetsLength; i++) {
const target = parsedTargetsArray[i];
if (!target[isRegister... | @overload
@param {DOMTargetsParam} targets
@return {DOMTargetsArray}
@overload
@param {JSTargetsParam} targets
@return {JSTargetsArray}
@overload
@param {TargetsParam} targets
@return {TargetsArray}
@param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets | registerTargets | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPath = path => {
const parsedTargets = parseTargets(path);
const $parsedSvg = /** @type {SVGGeometryElement} */ (parsedTargets[0]);
if (!$parsedSvg || !isSvg($parsedSvg))
return;
return $parsedSvg;
} | @param {TargetsParam} path
@return {SVGGeometryElement|undefined} | getPath | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPath = path => {
const parsedTargets = parseTargets(path);
const $parsedSvg = /** @type {SVGGeometryElement} */ (parsedTargets[0]);
if (!$parsedSvg || !isSvg($parsedSvg))
return;
return $parsedSvg;
} | @param {TargetsParam} path
@return {SVGGeometryElement|undefined} | getPath | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
morphTo = (path2, precision = .33) => ($path1) => {
const $path2 = /** @type {SVGGeometryElement} */ (getPath(path2));
if (!$path2)
return;
const isPath = $path1.tagName === 'path';
const separator = isPath ? ' ' : ',';
const previousPoints = $path1[morphPointsSymbol];
if (previousPoints... | @param {TargetsParam} path2
@param {Number} [precision]
@return {FunctionValue} | morphTo | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
morphTo = (path2, precision = .33) => ($path1) => {
const $path2 = /** @type {SVGGeometryElement} */ (getPath(path2));
if (!$path2)
return;
const isPath = $path1.tagName === 'path';
const separator = isPath ? ' ' : ',';
const previousPoints = $path1[morphPointsSymbol];
if (previousPoints... | @param {TargetsParam} path2
@param {Number} [precision]
@return {FunctionValue} | morphTo | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
createDrawableProxy = ($el, start, end) => {
const pathLength = K;
const computedStyles = getComputedStyle($el);
const strokeLineCap = computedStyles.strokeLinecap;
// @ts-ignore
const $scalled = computedStyles.vectorEffect === 'non-scaling-stroke' ? $el : null;
let currentCap = strokeLineCap;
... | Creates a proxy that wraps an SVGGeometryElement and adds drawing functionality.
@param {SVGGeometryElement} $el - The SVG element to transform into a drawable
@param {number} start - Starting position (0-1)
@param {number} end - Ending position (0-1)
@return {DrawableSVGGeometry} - Returns a proxy that preserves the o... | createDrawableProxy | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
createDrawableProxy = ($el, start, end) => {
const pathLength = K;
const computedStyles = getComputedStyle($el);
const strokeLineCap = computedStyles.strokeLinecap;
// @ts-ignore
const $scalled = computedStyles.vectorEffect === 'non-scaling-stroke' ? $el : null;
let currentCap = strokeLineCap;
... | Creates a proxy that wraps an SVGGeometryElement and adds drawing functionality.
@param {SVGGeometryElement} $el - The SVG element to transform into a drawable
@param {number} start - Starting position (0-1)
@param {number} end - Ending position (0-1)
@return {DrawableSVGGeometry} - Returns a proxy that preserves the o... | createDrawableProxy | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
get(target, property) {
const value = target[property];
if (property === proxyTargetSymbol)
return target;
if (property === 'setAttribute') {
return (...args) => {
if (args[0] === 'draw') {
const value = args... | Creates a proxy that wraps an SVGGeometryElement and adds drawing functionality.
@param {SVGGeometryElement} $el - The SVG element to transform into a drawable
@param {number} start - Starting position (0-1)
@param {number} end - Ending position (0-1)
@return {DrawableSVGGeometry} - Returns a proxy that preserves the o... | get | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
createDrawable = (selector, start = 0, end = 0) => {
const els = parseTargets(selector);
return els.map($el => createDrawableProxy(
/** @type {SVGGeometryElement} */ ($el), start, end));
} | Creates drawable proxies for multiple SVG elements.
@param {TargetsParam} selector - CSS selector, SVG element, or array of elements and selectors
@param {number} [start=0] - Starting position (0-1)
@param {number} [end=0] - Ending position (0-1)
@return {Array<DrawableSVGGeometry>} - Array of proxied elements with dra... | createDrawable | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
createDrawable = (selector, start = 0, end = 0) => {
const els = parseTargets(selector);
return els.map($el => createDrawableProxy(
/** @type {SVGGeometryElement} */ ($el), start, end));
} | Creates drawable proxies for multiple SVG elements.
@param {TargetsParam} selector - CSS selector, SVG element, or array of elements and selectors
@param {number} [start=0] - Starting position (0-1)
@param {number} [end=0] - Ending position (0-1)
@return {Array<DrawableSVGGeometry>} - Array of proxied elements with dra... | createDrawable | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPathPoint = ($path, progress, lookup = 0) => {
return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
} | @param {SVGGeometryElement} $path
@param {Number} progress
@param {Number}lookup
@return {DOMPoint} | getPathPoint | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPathPoint = ($path, progress, lookup = 0) => {
return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
} | @param {SVGGeometryElement} $path
@param {Number} progress
@param {Number}lookup
@return {DOMPoint} | getPathPoint | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPathProgess = ($path, pathProperty) => {
return $el => {
const totalLength = +($path.getTotalLength());
const inSvg = $el[isSvgSymbol];
const ctm = $path.getCTM();
/** @type {TweenObjectValue} */
return {
from: 0,
to: totalLength,
/** @t... | @param {SVGGeometryElement} $path
@param {String} pathProperty
@return {FunctionValue} | getPathProgess | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getPathProgess = ($path, pathProperty) => {
return $el => {
const totalLength = +($path.getTotalLength());
const inSvg = $el[isSvgSymbol];
const ctm = $path.getCTM();
/** @type {TweenObjectValue} */
return {
from: 0,
to: totalLength,
/** @t... | @param {SVGGeometryElement} $path
@param {String} pathProperty
@return {FunctionValue} | getPathProgess | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
isValidSVGAttribute = (el, propertyName) => {
// Return early and use CSS opacity animation instead (already better default values (opacity: 1 instead of 0)) and rotate should be considered a transform
if (cssReservedProperties.includes(propertyName))
return false;
if (el.getAttribute(propertyName) ... | @param {Target} el
@param {String} propertyName
@return {Boolean} | isValidSVGAttribute | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
isValidSVGAttribute = (el, propertyName) => {
// Return early and use CSS opacity animation instead (already better default values (opacity: 1 instead of 0)) and rotate should be considered a transform
if (cssReservedProperties.includes(propertyName))
return false;
if (el.getAttribute(propertyName) ... | @param {Target} el
@param {String} propertyName
@return {Boolean} | isValidSVGAttribute | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
rgbToRgba = rgbValue => {
const rgba = rgbExecRgx.exec(rgbValue) || rgbaExecRgx.exec(rgbValue);
const a = !isUnd(rgba[4]) ? +rgba[4] : 1;
return [
+rgba[1],
+rgba[2],
+rgba[3],
a
];
} | RGB / RGBA Color value string -> RGBA values array
@param {String} rgbValue
@return {ColorArray} | rgbToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
rgbToRgba = rgbValue => {
const rgba = rgbExecRgx.exec(rgbValue) || rgbaExecRgx.exec(rgbValue);
const a = !isUnd(rgba[4]) ? +rgba[4] : 1;
return [
+rgba[1],
+rgba[2],
+rgba[3],
a
];
} | RGB / RGBA Color value string -> RGBA values array
@param {String} rgbValue
@return {ColorArray} | rgbToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hexToRgba = hexValue => {
const hexLength = hexValue.length;
const isShort = hexLength === 4 || hexLength === 5;
return [
+('0x' + hexValue[1] + hexValue[isShort ? 1 : 2]),
+('0x' + hexValue[isShort ? 2 : 3] + hexValue[isShort ? 2 : 4]),
+('0x' + hexValue[isShort ? 3 : 5] + hexValue[... | HEX3 / HEX3A / HEX6 / HEX6A Color value string -> RGBA values array
@param {String} hexValue
@return {ColorArray} | hexToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hexToRgba = hexValue => {
const hexLength = hexValue.length;
const isShort = hexLength === 4 || hexLength === 5;
return [
+('0x' + hexValue[1] + hexValue[isShort ? 1 : 2]),
+('0x' + hexValue[isShort ? 2 : 3] + hexValue[isShort ? 2 : 4]),
+('0x' + hexValue[isShort ? 3 : 5] + hexValue[... | HEX3 / HEX3A / HEX6 / HEX6A Color value string -> RGBA values array
@param {String} hexValue
@return {ColorArray} | hexToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hue2rgb = (p, q, t) => {
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
return t < 1 / 6 ? p + (q - p) * 6 * t :
t < 1 / 2 ? q :
t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 :
p;
} | @param {Number} p
@param {Number} q
@param {Number} t
@return {Number} | hue2rgb | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hue2rgb = (p, q, t) => {
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
return t < 1 / 6 ? p + (q - p) * 6 * t :
t < 1 / 2 ? q :
t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 :
p;
} | @param {Number} p
@param {Number} q
@param {Number} t
@return {Number} | hue2rgb | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hslToRgba = hslValue => {
const hsla = hslExecRgx.exec(hslValue) || hslaExecRgx.exec(hslValue);
const h = +hsla[1] / 360;
const s = +hsla[2] / 100;
const l = +hsla[3] / 100;
const a = !isUnd(hsla[4]) ? +hsla[4] : 1;
let r, g, b;
if (s === 0) {
r = g = b = l;
}
else {
... | HSL / HSLA Color value string -> RGBA values array
@param {String} hslValue
@return {ColorArray} | hslToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
hslToRgba = hslValue => {
const hsla = hslExecRgx.exec(hslValue) || hslaExecRgx.exec(hslValue);
const h = +hsla[1] / 360;
const s = +hsla[2] / 100;
const l = +hsla[3] / 100;
const a = !isUnd(hsla[4]) ? +hsla[4] : 1;
let r, g, b;
if (s === 0) {
r = g = b = l;
}
else {
... | HSL / HSLA Color value string -> RGBA values array
@param {String} hslValue
@return {ColorArray} | hslToRgba | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
convertColorStringValuesToRgbaArray = colorString => {
return isRgb(colorString) ? rgbToRgba(colorString) :
isHex(colorString) ? hexToRgba(colorString) :
isHsl(colorString) ? hslToRgba(colorString) :
[0, 0, 0, 1];
} | All in one color converter that converts a color string value into an array of RGBA values
@param {String} colorString
@return {ColorArray} | convertColorStringValuesToRgbaArray | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
convertColorStringValuesToRgbaArray = colorString => {
return isRgb(colorString) ? rgbToRgba(colorString) :
isHex(colorString) ? hexToRgba(colorString) :
isHsl(colorString) ? hslToRgba(colorString) :
[0, 0, 0, 1];
} | All in one color converter that converts a color string value into an array of RGBA values
@param {String} colorString
@return {ColorArray} | convertColorStringValuesToRgbaArray | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
setValue = (targetValue, defaultValue) => {
return isUnd(targetValue) ? defaultValue : targetValue;
} | @template T, D
@param {T|undefined} targetValue
@param {D} defaultValue
@return {T|D} | setValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
setValue = (targetValue, defaultValue) => {
return isUnd(targetValue) ? defaultValue : targetValue;
} | @template T, D
@param {T|undefined} targetValue
@param {D} defaultValue
@return {T|D} | setValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getFunctionValue = (value, target, index, total, store) => {
if (isFnc(value)) {
const func = () => {
const computed = /** @type {Function} */ (value)(target, index, total);
// Fallback to 0 if the function returns undefined / NaN / null / false / 0
return !isNaN(+compute... | @param {TweenPropValue} value
@param {Target} target
@param {Number} index
@param {Number} total
@param {Object} [store]
@return {any} | getFunctionValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getFunctionValue = (value, target, index, total, store) => {
if (isFnc(value)) {
const func = () => {
const computed = /** @type {Function} */ (value)(target, index, total);
// Fallback to 0 if the function returns undefined / NaN / null / false / 0
return !isNaN(+compute... | @param {TweenPropValue} value
@param {Target} target
@param {Number} index
@param {Number} total
@param {Object} [store]
@return {any} | getFunctionValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
func = () => {
const computed = /** @type {Function} */ (value)(target, index, total);
// Fallback to 0 if the function returns undefined / NaN / null / false / 0
return !isNaN(+computed) ? +computed : computed || 0;
} | @param {TweenPropValue} value
@param {Target} target
@param {Number} index
@param {Number} total
@param {Object} [store]
@return {any} | func | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
func = () => {
const computed = /** @type {Function} */ (value)(target, index, total);
// Fallback to 0 if the function returns undefined / NaN / null / false / 0
return !isNaN(+computed) ? +computed : computed || 0;
} | @param {TweenPropValue} value
@param {Target} target
@param {Number} index
@param {Number} total
@param {Object} [store]
@return {any} | func | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getTweenType = (target, prop) => {
return !target[isDomSymbol] ? tweenTypes.OBJECT :
// Handle SVG attributes
target[isSvgSymbol] && isValidSVGAttribute(target, prop) ? tweenTypes.ATTRIBUTE :
// Handle CSS Transform properties differently than CSS to allow individual animations
... | @param {Target} target
@param {String} prop
@return {tweenTypes} | getTweenType | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getTweenType = (target, prop) => {
return !target[isDomSymbol] ? tweenTypes.OBJECT :
// Handle SVG attributes
target[isSvgSymbol] && isValidSVGAttribute(target, prop) ? tweenTypes.ATTRIBUTE :
// Handle CSS Transform properties differently than CSS to allow individual animations
... | @param {Target} target
@param {String} prop
@return {tweenTypes} | getTweenType | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getCSSValue = (target, propName, animationInlineStyles) => {
const inlineStyles = target.style[propName];
if (inlineStyles && animationInlineStyles) {
animationInlineStyles[propName] = inlineStyles;
}
const value = inlineStyles || getComputedStyle(target[proxyTargetSymbol] || target).getProperty... | @param {DOMTarget} target
@param {String} propName
@param {Object} animationInlineStyles
@return {String} | getCSSValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getCSSValue = (target, propName, animationInlineStyles) => {
const inlineStyles = target.style[propName];
if (inlineStyles && animationInlineStyles) {
animationInlineStyles[propName] = inlineStyles;
}
const value = inlineStyles || getComputedStyle(target[proxyTargetSymbol] || target).getProperty... | @param {DOMTarget} target
@param {String} propName
@param {Object} animationInlineStyles
@return {String} | getCSSValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {
const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);
return type === tweenTypes.OBJECT ? target[propName] || 0 :
type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */ (target).getAttribute(p... | @param {Target} target
@param {String} propName
@param {tweenTypes} [tweenType]
@param {Object|void} [animationInlineStyles]
@return {String|Number} | getOriginalAnimatableValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {
const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);
return type === tweenTypes.OBJECT ? target[propName] || 0 :
type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */ (target).getAttribute(p... | @param {Target} target
@param {String} propName
@param {tweenTypes} [tweenType]
@param {Object|void} [animationInlineStyles]
@return {String|Number} | getOriginalAnimatableValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getRelativeValue = (x, y, operator) => {
return operator === '-' ? x - y :
operator === '+' ? x + y :
x * y;
} | @param {Number} x
@param {Number} y
@param {String} operator
@return {Number} | getRelativeValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getRelativeValue = (x, y, operator) => {
return operator === '-' ? x - y :
operator === '+' ? x + y :
x * y;
} | @param {Number} x
@param {Number} y
@param {String} operator
@return {Number} | getRelativeValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
decomposeRawValue = (rawValue, targetObject) => {
/** @type {valueTypes} */
targetObject.t = valueTypes.NUMBER;
targetObject.n = 0;
targetObject.u = null;
targetObject.o = null;
targetObject.d = null;
targetObject.s = null;
if (!rawValue)
return targetObject;
const num = +raw... | @param {String|Number} rawValue
@param {TweenDecomposedValue} targetObject
@return {TweenDecomposedValue} | decomposeRawValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
decomposeRawValue = (rawValue, targetObject) => {
/** @type {valueTypes} */
targetObject.t = valueTypes.NUMBER;
targetObject.n = 0;
targetObject.u = null;
targetObject.o = null;
targetObject.d = null;
targetObject.s = null;
if (!rawValue)
return targetObject;
const num = +raw... | @param {String|Number} rawValue
@param {TweenDecomposedValue} targetObject
@return {TweenDecomposedValue} | decomposeRawValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
decomposeTweenValue = (tween, targetObject) => {
targetObject.t = tween._valueType;
targetObject.n = tween._toNumber;
targetObject.u = tween._unit;
targetObject.o = null;
targetObject.d = cloneArray(tween._toNumbers);
targetObject.s = cloneArray(tween._strings);
return targetObject;
} | @param {Tween} tween
@param {TweenDecomposedValue} targetObject
@return {TweenDecomposedValue} | decomposeTweenValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
decomposeTweenValue = (tween, targetObject) => {
targetObject.t = tween._valueType;
targetObject.n = tween._toNumber;
targetObject.u = tween._unit;
targetObject.o = null;
targetObject.d = cloneArray(tween._toNumbers);
targetObject.s = cloneArray(tween._strings);
return targetObject;
} | @param {Tween} tween
@param {TweenDecomposedValue} targetObject
@return {TweenDecomposedValue} | decomposeTweenValue | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getTweenSiblings = (target, property, lookup = '_rep') => {
const lookupMap = lookups[lookup];
let targetLookup = lookupMap.get(target);
if (!targetLookup) {
targetLookup = {};
lookupMap.set(target, targetLookup);
}
return targetLookup[property] ? targetLookup[property] : targetLooku... | @param {Target} target
@param {String} property
@param {String} lookup
@return {TweenPropertySiblings} | getTweenSiblings | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
getTweenSiblings = (target, property, lookup = '_rep') => {
const lookupMap = lookups[lookup];
let targetLookup = lookupMap.get(target);
if (!targetLookup) {
targetLookup = {};
lookupMap.set(target, targetLookup);
}
return targetLookup[property] ? targetLookup[property] : targetLooku... | @param {Target} target
@param {String} property
@param {String} lookup
@return {TweenPropertySiblings} | getTweenSiblings | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
addTweenSortMethod = (p, c) => {
return p._isOverridden || p._absoluteStartTime > c._absoluteStartTime;
} | @param {Tween} p
@param {Tween} c
@return {Number|Boolean} | addTweenSortMethod | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
addTweenSortMethod = (p, c) => {
return p._isOverridden || p._absoluteStartTime > c._absoluteStartTime;
} | @param {Tween} p
@param {Tween} c
@return {Number|Boolean} | addTweenSortMethod | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
composeTween = (tween, siblings) => {
const tweenCompositionType = tween._composition;
// Handle replaced tweens
if (tweenCompositionType === compositionTypes.replace) {
const tweenAbsStartTime = tween._absoluteStartTime;
addChild(siblings, tween, addTweenSortMethod, '_prevRep', '_nextRep');... | @param {Tween} tween
@param {TweenPropertySiblings} siblings
@return {Tween} | composeTween | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
composeTween = (tween, siblings) => {
const tweenCompositionType = tween._composition;
// Handle replaced tweens
if (tweenCompositionType === compositionTypes.replace) {
const tweenAbsStartTime = tween._absoluteStartTime;
addChild(siblings, tween, addTweenSortMethod, '_prevRep', '_nextRep');... | @param {Tween} tween
@param {TweenPropertySiblings} siblings
@return {Tween} | composeTween | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
constructor(parameters = {}, parent = null, parentPosition = 0) {
super(0);
const { id, delay, duration, reversed, alternate, loop, loopDelay, autoplay, frameRate, playbackRate, onComplete, onLoop, onPause, onBegin, onBeforeUpdate, onUpdate, } = parameters;
if (globals.scope)
globals... | @param {TimerParams} [parameters]
@param {Timeline} [parent]
@param {Number} [parentPosition] | constructor | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
seek(time, muteCallbacks = 0, internalRender = 0) {
// Recompose the tween siblings in case the timer has been cancelled
reviveTimer(this);
// If you seek a completed animation, otherwise the next play will starts at 0
this.completed = false;
const isPaused = this.paused;
... | @param {Number} time
@param {Boolean|Number} [muteCallbacks]
@param {Boolean|Number} [internalRender]
@return {this} | seek | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
revert() {
tick(this, 0, 1, 0, tickModes.AUTO);
const ap = /** @type {ScrollObserver} */ (this._autoplay);
if (ap && ap.linked && ap.linked === this)
ap.revert();
return this.cancel();
} | Cancels the timer by seeking it back to 0 and reverting the attached scroller if necessary
@return {this} | revert | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
complete() {
return this.seek(this.duration).cancel();
} | Imediatly completes the timer, cancels it and triggers the onComplete callback
@return {this} | complete | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
then(callback = noop) {
const then = this.then;
const onResolve = () => {
// this.then = null prevents infinite recursion if returned by an async function
// https://github.com/juliangarnierorg/anime-beta/issues/26
this.then = null;
callback(this);
... | @param {Callback<this>} [callback]
@return {Promise} | then | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
onResolve = () => {
// this.then = null prevents infinite recursion if returned by an async function
// https://github.com/juliangarnierorg/anime-beta/issues/26
this.then = null;
callback(this);
this.then = then;
this._resolve = noop;
} | @param {Callback<this>} [callback]
@return {Promise} | onResolve | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
onResolve = () => {
// this.then = null prevents infinite recursion if returned by an async function
// https://github.com/juliangarnierorg/anime-beta/issues/26
this.then = null;
callback(this);
this.then = then;
this._resolve = noop;
} | @param {Callback<this>} [callback]
@return {Promise} | onResolve | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
binarySubdivide = (aX, mX1, mX2) => {
let aA = 0, aB = 1, currentX, currentT, i = 0;
do {
currentT = aA + (aB - aA) / 2;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0) {
aB = currentT;
}
else {
aA = currentT;
}
} whil... | @param {Number} aX
@param {Number} mX1
@param {Number} mX2
@return {Number} | binarySubdivide | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
binarySubdivide = (aX, mX1, mX2) => {
let aA = 0, aB = 1, currentX, currentT, i = 0;
do {
currentT = aA + (aB - aA) / 2;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0) {
aB = currentT;
}
else {
aA = currentT;
}
} whil... | @param {Number} aX
@param {Number} mX1
@param {Number} mX2
@return {Number} | binarySubdivide | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none :
t => t === 0 || t === 1 ? t :
calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2) | @param {Number} [mX1]
@param {Number} [mY1]
@param {Number} [mX2]
@param {Number} [mY2]
@return {EasingFunction} | cubicBezier | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none :
t => t === 0 || t === 1 ? t :
calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2) | @param {Number} [mX1]
@param {Number} [mY1]
@param {Number} [mX2]
@param {Number} [mY2]
@return {EasingFunction} | cubicBezier | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
linear = (...args) => {
const argsLength = args.length;
if (!argsLength)
return none;
const totalPoints = argsLength - 1;
const firstArg = args[0];
const lastArg = args[totalPoints];
const xPoints = [0];
const yPoints = [parseNumber(firstArg)];
for (let i = 1; i < totalPoints; i+... | Without parameters, the linear function creates a non-eased transition.
Parameters, if used, creates a piecewise linear easing by interpolating linearly between the specified points.
@param {...String|Number} [args] - Points
@return {EasingFunction} | linear | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
linear = (...args) => {
const argsLength = args.length;
if (!argsLength)
return none;
const totalPoints = argsLength - 1;
const firstArg = args[0];
const lastArg = args[totalPoints];
const xPoints = [0];
const yPoints = [parseNumber(firstArg)];
for (let i = 1; i < totalPoints; i+... | Without parameters, the linear function creates a non-eased transition.
Parameters, if used, creates a piecewise linear easing by interpolating linearly between the specified points.
@param {...String|Number} [args] - Points
@return {EasingFunction} | linear | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
irregular = (length = 10, randomness = 1) => {
const values = [0];
const total = length - 1;
for (let i = 1; i < total; i++) {
const previousValue = values[i - 1];
const spacing = i / total;
const segmentEnd = (i + 1) / total;
const randomVariation = spacing + (segmentEnd - s... | Generate random steps
@param {Number} [length] - The number of steps
@param {Number} [randomness] - How strong the randomness is
@return {EasingFunction} | irregular | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
irregular = (length = 10, randomness = 1) => {
const values = [0];
const total = length - 1;
for (let i = 1; i < total; i++) {
const previousValue = values[i - 1];
const spacing = i / total;
const segmentEnd = (i + 1) / total;
const randomVariation = spacing + (segmentEnd - s... | Generate random steps
@param {Number} [length] - The number of steps
@param {Number} [randomness] - How strong the randomness is
@return {EasingFunction} | irregular | javascript | juliangarnier/anime | types/index.js | https://github.com/juliangarnier/anime/blob/master/types/index.js | MIT |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.