From Jenny.
Prototype:
function addWipedOverlay(clip c, clip overlay, int x, int y, int frames, int width)
Arguments:
c: the video clip you want to overlay
overlay: your banner
x: x position in image for banner to slide across from
y: y position in image
frames: the number of frames in which to accomplish wiping and fading in
width: the width over the overlay banner (if this is too big you will get an error from crop about destination width less than zero)
Notes:
Assumes a transparency channel. To get this, you need to load your image with the pixel_type=”RGB32″ flag.
Example:
img = ImageSource("BannerName.png", pixel_type="RGB32") clip1 = addWipedOverlay(clip1, img, 0, 875, 30, 1279, 0)
This is actually two functions because it uses recursion to implement a for loop:
function addWipedOverlay(clip c, clip overlay, int x, int y, int frames, int width) { return addWipedOverlayRecur(c, overlay, x, y, frames, width, 0) } function addWipedOverlayRecur(clip c, clip overlay, int x, int y, int frames, int width, int iteration) { cropped_overlay = crop(overlay, int((1.0 - 1.0 / frames * iteration) * width), 0, 0, 0) return (iteration == frames) \ ? Overlay(Trim(c, frames, 0), overlay, x = x, y = y, mask=overlay.ShowAlpha) \ : Trim(Overlay(c, cropped_overlay, x = x, y = y, mask = cropped_overlay.ShowAlpha, opacity = 1.0 / frames * iteration), iteration, (iteration == 0) ? -1 : iteration) + addWipedOverlayRecur(c, overlay, x, y, frames, width, iteration + 1) }
11/30/13