1
두 개의 라파엘 (Raphael) 물체가 함께 움직이는 동안 하나의 물체가 회전하는 것이 좋습니다. 아래 예제에서는 번역을위한 애니메이션과 회전을위한 애니메이션 두 가지를 만들었지 만 운 좋게도 작동하지 않았습니다.Raphael 애니메이션을 결합하는 방법은 무엇입니까?
var paper = Raphael(0,0,800,400);
var body = paper.rect(10,10,50,30);
var leg = paper.rect(30,35,10,30);
// translation - should be applied to both body and leg
var translation_anim = Raphael.animation({transform: "t300,0"}, 2000);
// rotation - to be applied to the leg only
var rotation_anim = Raphael.animation({
"50%": { transform: "R" + (45).toString() },
"100%": { transform: "R" + (-1*45).toString() }
}, 2000);
body.animate(translation_anim);
leg.animateWith(body,rotation_anim,translation_anim);
바이올린 : http://jsfiddle.net/hx22d/
이 문제를 해결하기 위해 최선을 다했습니다.이 답변을 살펴보고 도움이되는지 확인해보십시오. http://stackoverflow.com/questions/15886606/how-to-use-raphael-animatewith – Neil
@ 닐, 제가 지출했습니다. 꽤 많은 시간이 답변과 해당 바이올린을보고 있지만,이 경우 두 애니메이션에 대해 동일한 매개 변수가 있습니다. 팔과 동기화 된 움직임에 더하여, 무게가 중심을 중심으로 회전하기를 원한다면 내 문제와 같은 문제 일 것입니다. –