Input video: playDesign
Output SVG motion program code
Output SVG motion program
Input SVG motion program
MPTransformer(P, args):
// Replace the red ball with cheese shape.
redObjs = objSelector(P, propQuery, "color", “red”, [0, P.endFrm])
collisionPreserveObjTransformer(redObjs, args.cheese, [0, P.endFrm])
// OBJECT SELECTOR: Get all the white letters.
letterObjs = objSelector(P, propQuery, "color", “white”, [0, P.endFrm])
// OBJECT TRANSFORMER: Replace them with pasta shapes.
// Pasta images are the same dimensions as the replaced letters.
changeAppearanceObjTransformer(letterObjs, pastaImgs, [0, P.endFrm])
Motion program transformer code. Here we swap out all the letters in the input video for pasta shapes with changeAppearanceObjTransformer. We then change the appearance of the red ball to a small cheese block by using collisionPreserveObjTransformer to ensure that the cheese block hits all the pasta shapes in the right locations at the right time.
Output SVG motion program