sequence는 차례로, parallel은 함께, stagger는 간격을 두고 차례로 시작하고, delay는 기다리고, loop는 반복합니다. 결과도 컨트롤러이므로 조합을 중첩할 수 있습니다.
예제를 준비하는 중…
start, stop, reset
모든 컨트롤러에는 start(callback?), stop(), reset()이 있습니다. 콜백은 { finished }를 받으며, 모션이 멈추거나 교체되면 false입니다.
같은 값에서 새 드라이버를 시작하면 실행 중인 드라이버를 지금 위치에서 교체합니다. 어느 끝으로도 튀지 않습니다.
controller.js
const move = timing(value, { toValue: 1, duration: 600 });
move.start(({ finished }) => {
// finished is false when stopped or replaced by a new animation
});
move.stop(); // keeps the value where it is on screen
move.reset(); // returns to where this animation started
다른 값 추적하기
살아 있는 toValue는 그 값이 바뀔 때마다 드라이버를 다시 시작합니다. React Native의 tracking과 같습니다. follow(target, source)는 같은 스프링 연결을 이름 있는 함수로 쓴 것입니다.
tracking.js
// A live toValue tracks another value, like React Native tracking.spring(badge, { toValue: pointer, stiffness: 300, damping: 26 }).start();
// follow() is the same connection as a named function.follow(badge, pointer, { stiffness: 300, damping: 26 });
Easing과 키프레임
Easing은 React Native와 같습니다. linear, quad, cubic, sin, circle, exp, elastic, back, bounce, bezier와 in, out, inOut 도우미가 있습니다. keyframes(value, frames, options)는 선택적인 times, repeat로 값 하나를 여러 숫자에 걸쳐 움직입니다.