Skip to content

Instantly share code, notes, and snippets.

@pranaybinju
Last active January 24, 2020 10:36
Show Gist options
  • Save pranaybinju/40428d36be240f9077a60b2c25ee11b2 to your computer and use it in GitHub Desktop.
Save pranaybinju/40428d36be240f9077a60b2c25ee11b2 to your computer and use it in GitHub Desktop.
function runTiming(clock, value, dest) {
const state = {
finished: new Value(0),
position: value,
time: new Value(0),
frameTime: new Value(0),
};
const config = {
duration: 1000,
toValue: dest,
easing: Easing.inOut(Easing.cubic),
};
return block([
cond(clockRunning(clock), 0, [
set(state.finished, 0),
set(state.time, 0),
set(state.position, value),
set(state.frameTime, 0),
set(config.toValue, dest),
startClock(clock),
]),
timing(clock, state, config),
cond(state.finished, debug('stop clock', stopClock(clock))),
state.position,
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment