Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.scrollToPoint = (point, options = {}) => {
const { x, y } = this._scrollPoint
if (this.animation) {
this.animation.pause()
}
// Create the targets to animate
const targets = {
x: x.get(),
y: y.get(),
}
// Use animejs to animate target to new values,
// and update the motionValues when these change
this._animation = animejs_1.default(
Object.assign(
{
targets,
x: -point.x,
y: -point.y,
change: () => {
x.set(targets.x)
y.set(targets.y)
},
begin: () => (this._isAnimating = true),
complete: () => (this._isAnimating = false),
},
options
)
)
return this._animation
this.animate = (options) => {
const targets = Object.assign({}, this.state.input);
this._animation = animejs_1.default(Object.assign({ targets }, options, { update: () => {
this.setInput(targets);
} }));
return this._animation;
};
this.setInput = (props, initial = false) => {
this.animate = (options, target) => {
const targets = target ? Object.assign({}, this.state[target]) : Object.assign({}, this.state);
this._animation = animejs_1.default(Object.assign({ targets }, options, { change: () => {
if (target) {
this.setState({
[target]: targets,
});
}
else {
this.setState(targets);
}
}, begin: () => (this._isAnimating = true), complete: () => (this._isAnimating = false) }));
return this._animation;
};
/**