Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eases.forEach(function (e) {
// convert to camelCase
var easeName = e.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
// add instance methods dynamically
_this[easeName] = function (prop, end, duration) {
return this.animate(prop, end, duration, easeName);
};
Easing[easeName] = ease(e);
});
}
eases.forEach( (e) => {
// convert to camelCase
var easeName = e.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
// add instance methods dynamically
this[easeName] = function(prop, end, duration) {
return this.animate(prop, end, duration, easeName)
}
Easing[easeName] = ease(e)
});
}
export function animate(inst, name, fromStyle, toStyle, duration, {
easing = DEFAULT_EASING,
onTick = noop,
onAbort = noop,
onComplete = noop,
preventMobileHA = false,
}) {
if(isAnimated(inst, name)) {
abort(inst, name);
}
const ease = typeof easing === 'object' ?
d3ease.ease(...[easing.type, ...easing.arguments]) :
d3ease.ease(easing)
;
const stylesTransition = _()
.union(fromStyle)
.union(toStyle)
.map(
(property) => [
property,
[
fromStyle[property] || toStyle[property],
toStyle[property] || fromStyle[property],
],
],
)
.toPairs()
.value();
export function animate(inst, name, fromStyle, toStyle, duration, {
easing = DEFAULT_EASING,
onTick = noop,
onAbort = noop,
onComplete = noop,
preventMobileHA = false,
}) {
if(isAnimated(inst, name)) {
abort(inst, name);
}
const ease = typeof easing === 'object' ?
d3ease.ease(...[easing.type, ...easing.arguments]) :
d3ease.ease(easing)
;
const stylesTransition = _()
.union(fromStyle)
.union(toStyle)
.map(
(property) => [
property,
[
fromStyle[property] || toStyle[property],
toStyle[property] || fromStyle[property],
],
],
)
.toPairs()
.value();