Input video: ball1
Output SVG motion program code
Output SVG motion program
Input SVG motion program
MPTransformer(P, args):
// OBJECT SELECTOR: Select dark blue ball.
selObjs = objSelector(P, propQuery, "color", "dark-blue", [0, P.endFrm])
// OBJECT TRANSFORMER: Replace appearance and preserve collisions.
collisionPreserveObjTransformer(selObjs, "coin.png", [0, P.endFrm])
// OBJECT SELECTOR: Select yellow ball.
selObjs = objSelector(P, propQuery, "color", "yellow", [0, P.endFrm])
// OBJECT TRANSFORMER: Replace its appearance with piggybank.
changeAppearanceObjTransformer(obj, “piggybank.png”, [0, P.endFrm])
Motion program transformer code. Here we replace the yellow ball with a piggybank and the gray ball with a small coin. To make sure the smaller coin still collides with the piggybank in the right place, we use a collisionPreserveObjTransformer.
Output SVG motion program