Input video: confetti
Output SVG motion program code
Output SVG motion program
SVG motion program code (uncorrected tracking)
SVG motion program (uncorrected tracking)
Input SVG motion program
MPTransformer(P, args):
// Change background image.
setBgImg(P, args.background)
// OBJECT SELECTOR: Select all confetti.
confettiObjs = objSelector(P, propQuery, "color", "not black", [0, P.endFrm])
// OBJECT TRANSFORMER: Remove held frames.
removeHeldFramesObjTransformer(confettiObjs, [0, P.endFrm])
// Rotate and resize all confetti by random amounts and fall back and forth.
function rotate(t, [theta]):
deg = 120 * (randFloat() - 0.5)
return deg
adjustGlobalObjTransformer(confettiObjs, rotate [0, P.endFrm])
function random_size(t, [sx, sy]):
amt = randFloat() * 0.5 + 0.5
return [amt, amt]
adjustGlobalObjTransformer(confettiObjs, random_size, [0, P.endFrm])
function petal_fall(t, [x, offset]):
return offset * sin(t)
motionTexObjTransformer(confettiObjs, petal_fall, [0, P.endFrm], offset=60)
// OBJECT SELECTOR: Select letter 'C'.
cObjs = objSelector(P, propQuery, "id", "shape_09", [0, P.endFrm])
// OBJECT TRANSFORMER: Change to 'SPRING' text.
changeAppearanceObjTransformer(cObjs, args.season)
// Remove remaining letters.
letterObjs = obj_selector(P, propQuery, "color", "black", [0, P.endFrm])
removeObjs(letterObjs)
// OBJECT TRANSFORMER: Make all confetti slower and animate on 3s.
linearRetimeObjTransformer(confettiObjs, 6, [0, P.endFrm])
animOnNsObjTransformer(confettiObjs, 3, [0, P.endFrm])
// Replace all objects with flowers.
// The random_choice(arr, size) function selects a random subset of size with replacement
// from a list of choices.
new_appearances = random_choice(args.confetti_imgs, len(confettiObjs))
changeAppearanceObjTransformer(confettiObjs, new_appearances)
// Randomly adjust depth layering.
function random_raise_z(t, [z]):
return random_choice([-10, 10])
adjustGlobalObjTransformer(confettiObjs, random_raise_z, [0, P.endFrm])
Motion program transformer code. We change the appearance of the background, text and falling objects to spring-themed images. In order to make the falling petals look more natural, we apply a swaying motion texture. Finally, we animate the entire video on 3s to better match the pixel art look.
Output SVG motion program
Input SVG motion program
MPTransformer(P, args):
// Change background image.
setBgImg(P, args.background)
// OBJECT SELECTOR: Select all confetti.
confettiObjs = objSelector(P, propQuery, "color", "not black", [0, P.endFrm])
// OBJECT TRANSFORMER: Remove held frames.
removeHeldFramesObjTransformer(confettiObjs, [0, P.endFrm])
// Rotate all confetti by 30 degrees, start all falling slightly further to
// the right, and make it drift to the left.
function rotate(t, [theta, deg]):
return deg
adjustGlobalObjTransformer(confettiObjs, rotate, [0, P.endFrm], deg=30)
function drift(t, [x, offset, pix]):
return offset + pix * t / len(x)
adjustLocalObjTransformer(confettiObjs, drift, [0, P.endFrm], drift, offset=30, pix=-45)
// OBJECT SELECTOR: Select letter 'C'.
cObjs = objSelector(P, propQuery, "id", "shape_09", [0, P.endFrm])
// OBJECT TRANSFORMER: Change to 'SUMMER' text.
changeAppearanceObjTransformer(cObjs, args.season)
// Remove remaining letters.
letterObjs = obj_selector(P, propQuery, "color", "black", [0, P.endFrm])
removeObjs(letterObjs)
// OBJECT TRANSFORMER: Make all confetti slower and animate on 3s.
linearRetimeObjTransformer(confettiObjs, 3, [0, P.endFrm])
animOnNsObjTransformer(confettiObjs, 3, [0, P.endFrm])
// Replace all objects with raindrops.
new_appearances = random_choice(args.confetti_imgs, len(confettiObjs))
changeAppearanceObjTransformer(confettiObjs, new_appearances)
// Randomly adjust depth layering.
function random_raise_z(t, [z]):
return random_choice([-10, 10])
adjustGlobalObjTransformer(confettiObjs, random_raise_z, [0, P.endFrm])
Motion program transformer code. We use a similar program transformation as 'SPRING', but with a drift instead of a swaying motion for the falling raindrops. We also make the rain fall at a faster rate than the petals.
Output SVG motion program
Input SVG motion program
MPTransformer(P, args):
// Change background image.
setBgImg(P, args.background)
// OBJECT SELECTOR: Select all confetti.
confettiObjs = objSelector(P, propQuery, "color", "not black", [0, P.endFrm])
// OBJECT TRANSFORMER: Remove held frames.
removeHeldFramesObjTransformer(confettiObjs, [0, P.endFrm])
// Rotate and resize all confetti by random degrees and fall back and forth.
function rotate(t, [theta]):
deg = 120 * (randFloat() - 0.5)
return deg
adjustGlobalObjTransformer(confettiObjs, 0, m_duration, ['rotate'], rotate)
function random_size(t, [sx, sy]):
amt = randFloat() * 0.5 + 0.5
return [amt, amt]
adjustGlobalObjTransformer(confettiObjs, random_size, [0, P.endFrm])
function leaf_fall(t, [x, offset]):
return offset * sin(t)
motionTexObjTransformer(confettiObjs, leaf_fall, [0, P.endFrm], offset=30)
// OBJECT SELECTOR: Select letter 'C'.
cObjs = objSelector(P, propQuery, "id", "shape_09", [0, P.endFrm])
// OBJECT TRANSFORMER: Change to 'AUTUMN' text.
changeAppearanceObjTransformer(cObjs, args.season)
// Remove remaining letters.
letterObjs = obj_selector(P, propQuery, "color", "black", [0, P.endFrm])
removeObjs(letterObjs)
// OBJECT TRANSFORMER: Make all confetti slower and animate on 3s.
linearRetimeObjTransformer(confettiObjs, 4, [0, P.endFrm])
animOnNsObjTransformer(confettiObjs, 3, [0, P.endFrm])
// Replace all objects with leaves.
new_appearances = random_choice(args.confetti_imgs, len(confettiObjs))
changeAppearanceObjTransformer(confettiObjs, new_appearances)
// Randomly adjust depth layering.
function random_raise_z(t, [z]):
return random_choice([-10, 10])
adjustGlobalObjTransformer(confettiObjs, random_raise_z, [0, P.endFrm])
Motion program transformer code. We use a similar program transformation as 'SPRING', but the retime the leaves to fall faster and adjust their motions to sway less than the flower petals.
Output SVG motion program
Input SVG motion program
MPTransformer(P, args):
// Change background image.
setBgImg(P, args.background)
// OBJECT SELECTOR: Select all confetti.
confettiObjs = objSelector(P, propQuery, "color", "not black", [0, P.endFrm])
// OBJECT TRANSFORMER: Remove held frames.
removeHeldFramesObjTransformer(confettiObjs, [0, P.endFrm])
// Rotate and resize all confetti by random degrees and fall back and forth.
function rotate(t, [theta]):
deg = 120 * (randFloat() - 0.5)
return deg
adjustGlobalObjTransformer(confettiObjs, 0, m_duration, ['rotate'], rotate)
function leaf_fall(t, [x, offset]):
return offset * sin(t)
motionTexObjTransformer(confettiObjs, leaf_fall, [0, P.endFrm], offset=60)
// OBJECT SELECTOR: Select letter 'C'.
cObjs = objSelector(P, propQuery, "id", "shape_09", [0, P.endFrm])
// OBJECT TRANSFORMER: Change to 'WINTER' text.
changeAppearanceObjTransformer(cObjs, args.season)
// Remove remaining letters.
letterObjs = obj_selector(P, propQuery, "color", "black", [0, P.endFrm])
removeObjs(letterObjs)
// OBJECT TRANSFORMER: Make all confetti slower and animate on 3s.
linearRetimeObjTransformer(confettiObjs, 5, [0, P.endFrm])
animOnNsObjTransformer(confettiObjs, 3, [0, P.endFrm])
// Replace all objects with snowflakes.
new_appearances = random_choice(args.confetti_imgs, len(confettiObjs))
changeAppearanceObjTransformer(confettiObjs, new_appearances)
// Randomly adjust depth layering.
function random_raise_z(t, [z]):
return random_choice([-10, 10])
adjustGlobalObjTransformer(confettiObjs, random_raise_z, [0, P.endFrm])
Motion program transformer code. We use a similar program transformation as 'SPRING', but the retime the snowflakes to fall slightly faster and adjust their motions to sway less than the flower petals.
Output SVG motion program