JSFiddle - React, Tailwind, and code Playground
JavaScript
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( {
"25%": { transform: "r45 T75,0"},
"50%": { transform: "r-45 T150,0"},
"75%": { transform: "r45 T225,0"},
"100%": { transform: "r-45 T300,0"}
}, 2000);
body.animate(translation_anim);
leg.animateWith(body,translation_anim,rotation_anim);