Animation 객체
메서드
// group객체의 transition을 사용하지 않음 group.animation.enable(false); // Getter var enable = group.animation.enable(); // group에 속한 element들중 하나라도 enable 값이 false이면 false 값을 반환합니다.
var transition = { duration: 1, timeFunction: 'ease', delay: 0 } group.animation.config(transition);
group.animation.sequence() .next({x: 30}) .play(function(){ // transition 완료 })
// transition 설정 group.animation.config({ duration: 1, timeFunction: 'ease', delay: 0 }); group.animation.sequence() .next({x: 300, y: 300}) .next({x: 600, y: 300}) .next({x: 600, y: 600}) // 값 변동 없으므로 아래 두 next 메서드는 무시됨 .next({x: 600, y: 600}) .next({x: 600, y: 600}) .next({x: 300, y: 600}) .next({x: 300, y: 300}); .play();// `transition`을 개별적으로 지정하고자 할때 group.animation.sequence() .next({x: 300, y: 300}, { duration: 0.3, timeFunction: 'linear', delay: delay}) .next(x: 600, y: 300}) .next({x: 600, y: 600}) .next({x: 300, y: 600}, { duration: 2, timeFunction: 'ease', delay: delay }) .next({x: 300, y: 300}, { duration: 1, timeFunction: 'linear', delay: delay}); .play()group.animation.sequence() .next({x: 300, y: 300}) // 1 초 후 (600,300) 위치로 transition 됨 .delay(1) .next({x: 600, y: 300}) .play();group.animation.sequence() .next({x: 300, y: 300}) .play(function(loop_counter){ // 에니메이션 완료완 }); // loop가 설정된 경우 seq.stop() // 5회만 반복 .loop(5) .play(nulll, loop_counter){ // loop_counter : 현재 몇번 반복 실행되고 있는지 횟수 });var seq = group.animation.sequence() .next({x: 100}) .next({x: 200}) .next({x: 300}); // 실행 seq.play(); ... // (200으로 이동 후) 멈춤 seq.stop(); ... // 다시 실행 : (100) 위치로 다시 이동하여 실행됨 seq.play(); // stop의 경우 리턴 값에 특별히 pipe 메서드가 제공되어 // 다른 animation으로 전환할 수 있습니다. seq.stop() .pipe(function(){ // 계속해서 다른 seq2 실행 seq2.play(); });var seq = group.animation.sequence() .next({x: 100}) .next({x: 200}) .next({x: 300}); // 실행 seq.play(); ... // (200으로 이동 후) 일시 정지 seq.pause(); ... // 다시 실행 : (300) 위치로 이동됨 seq.play();var seq = group.animation.sequence() .next({x: 100}) .next({x: 200}) .next({x: 300}) // 무한반복 .loop(); .play(); ... seq.stop() // 5회만 반복 .loop(5) .play();// callback 함수로 반복 실행 만들기 var seq = group.animation.sequence() .next({x: 100}) .next({x: 200}) .next({x: 300}) //.loop(); .play(onComplete); function onComplete(repeat){ // 무한반복 seq.play(onComplete); }var seq = group.animation.sequence() .next({x: 100}) .next({x: 200}) .next({x: 300}) .loop(); .play(onComplete); function onComplete(repeat){ if(repeat%2 === 0){ // 역방향 진행 seq.reverse(); } }var seq = group.animation.sequence() ... .loop() .play(); // 애니메이션 실행됨 seq.stop().play(); // 실행 객체를 찾지 못해 실행할 수 없음 seq.clear() seq.play();
Last updated