minor tidy up

pull/1937/head
Richard Harris 6 years ago
parent 35aee272d6
commit 84d501b5fb

@ -117,20 +117,18 @@ export function spring(value, opts = {}) {
last_time = window.performance.now();
settled = false;
task = loop(() => {
const time = window.performance.now();
task = loop(now=> {
({ value, settled } = tick_spring(
velocity,
value,
target_value,
spring.stiffness,
spring.damping,
(time - last_time) * 60 / 1000,
(now - last_time) * 60 / 1000,
threshold
));
last_time = time;
last_time = now;
if (settled) {
value = target_value;

@ -76,9 +76,8 @@ export function tweened(value, defaults = {}) {
const start = window.performance.now() + delay;
let fn;
task = loop(() => {
const time = window.performance.now();
if (time < start) return true;
task = loop(now => {
if (now < start) return true;
if (!started) {
fn = interpolate(value, new_value);
@ -91,7 +90,7 @@ export function tweened(value, defaults = {}) {
previous_task = null;
}
const elapsed = time - start;
const elapsed = now - start;
if (elapsed > duration) {
store.set(value = new_value);

Loading…
Cancel
Save