Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('easing is taken from the destination frame', () => {
let tweenableComparator;
actor
.keyframe(0, { x: 0 }, 'linear')
.keyframe(1000, { x: 100 }, 'easeInSine')
.keyframe(2000, { x: 200 }, 'easeOutCirc');
tweenableComparator =
interpolate({ x: 0 }, { x: 100 }, 0.5, 'easeInSine');
actor._updateState(500);
assert.equal(actor.get().x, tweenableComparator.x);
tweenableComparator =
interpolate({ x: 100 }, { x: 200 }, 0.5, 'easeOutCirc');
actor._updateState(1500);
assert.equal(actor.get().x, tweenableComparator.x);
});
});
it('easing is taken from the destination frame', () => {
let tweenableComparator;
actor
.keyframe(0, { x: 0 }, 'linear')
.keyframe(1000, { x: 100 }, 'easeInSine')
.keyframe(2000, { x: 200 }, 'easeOutCirc');
tweenableComparator =
interpolate({ x: 0 }, { x: 100 }, 0.5, 'easeInSine');
actor._updateState(500);
assert.equal(actor.get().x, tweenableComparator.x);
tweenableComparator =
interpolate({ x: 100 }, { x: 200 }, 0.5, 'easeOutCirc');
actor._updateState(1500);
assert.equal(actor.get().x, tweenableComparator.x);
});
});
rekapi.update(50);
const transformChunks = actor.get().transform.match(/(\d|\.)+/g);
assert.equal(
transformChunks[1],
interpolate({ x: 0 }, { x: 1 }, 0.5, 'linear').x
);
assert.equal(
transformChunks[2],
interpolate({ x: 0 }, { x: 1 }, 0.5, 'easeInQuad').x
);
assert.equal(
transformChunks[3],
interpolate({ x: 0 }, { x: 1 }, 0.5, 'easeOutQuad').x
);
});
Path.prototype._calculateFrom = function _calculateFrom(easing) {
return Tweenable.interpolate(this._opts.from, this._opts.to, this.value(), easing);
};
Path.prototype._calculateFrom = function _calculateFrom(easing) {
return shifty.interpolate(this._opts.from, this._opts.to, this.value(), easing);
};
Path.prototype._calculateTo = function _calculateTo(progress, easing) {
return Tweenable.interpolate(this._opts.from, this._opts.to, progress, easing);
};
const nextProperty = this.nextProperty;
if (typeof this.value === 'boolean') {
return this.value;
} else if (nextProperty) {
const boundedMillisecond = Math.min(
Math.max(millisecond, this.millisecond),
nextProperty.millisecond
);
const { name } = this;
const delta = nextProperty.millisecond - this.millisecond;
const interpolatePosition =
(boundedMillisecond - this.millisecond) / delta;
return interpolate(
{ [name]: this.value },
{ [name]: nextProperty.value },
interpolatePosition,
nextProperty.easing
)[name];
} else {
return this.value;
}
}
Path.prototype._calculateTo = function _calculateTo(progress, easing) {
return Tweenable.interpolate(this._opts.from, this._opts.to, progress, easing);
};
Path.prototype._calculateTo = function _calculateTo(progress, easing) {
return shifty.interpolate(this._opts.from, this._opts.to, progress, easing);
};
Path.prototype._calculateTo = function _calculateTo(progress, easing) {
return shifty.interpolate(this._opts.from, this._opts.to, progress, easing);
};