vampiredom
14th December 2011, 01:27
Too long for one post ... Here is the description of the function and its parameters. The actual script will be in post #2 (http://forum.doom9.org/showthread.php?p=1544841#post1544841).
GradientWipe() provides plenty of options to create an endless variety of custom wipe transitions.
#######################################################################################################################
#
# GradientWipe() 2011/12/13 by vampiredom
# -----------------------------------------------------------------------------------
# Luminance-based animated mask transitions similar to "Gradient Wipe" or "Alpha Wipe" transitions found in NLEs.
#
# Requirements: Gscript.dll
# VariableBlur.dll
#
#######################################################################################################################
#
# Usage:
# ------
# GradientWipe(clip a, clip b1 [, clip b2..b99], "map",
# \ int "duration", int "softness", bool "backward", bool "clamp"
# \ int "blur_pre", int "blur_post", bool "ease", bool "xfade"
# \)
#
# Parameters:
# ---------------------------
# a, b1 [, b2..b99] clips
# ---------------------------
# Gradient() requires between 2 and 99 clips as input. It will wipe from a to b1 [to b2, b3..]
# If you want audio output, all clips should have matching sample rate, number of channels, etc.
# If some clips contain audio while others do not, they will be conformed to match those with audio.
# Audio will cross-fade as the video wipes unless xfade=false
# --------------------------------------------------
# map string or clip [default "b"]
# --------------------------------------------------
# The map paramter sets the luminance map used for the transition. It can be a clip or a string.
# By default, map = "b" ... this will use the luminance of the b clip, so as to make a unique transition.
# When map = "a", the luminance of the a clip will be used for the transition. In addition to "a" and "b", you can
# also specify a string that will generate a gradient map as follows: map = "segments,tiles1,tiles2,vertical"
#
# The comma-separated strings are passed to the MakeGradientBands() function and are as follows, in order:
#
# segments integer [<1 or >1]
# tiles1 integer [<1 or >1]
# tiles2 integer [<1 or >1]
# vertical boolean
#
# segments: This determines how many segments the 256-level gradient will be broken into.
# The default is 1, which will make a single strip from black->white (0->255)
# When a value of 2 is used, 2 strips will be created; (0->127) and (128->255)
# A negative value causes the segments to alternate direction. For example:
# A value of -2 will create (0->127), (255->128)
# A value of -4 will create (0->63), (127->64), (128->191), (255->192)
# The segments are stacked in rows or columns [depending on the "vertical" setting]
# tiles1: Values > 1 will tile each segment (adding columns when vertical=false, rows when vertical=true)
# Values < 1 will tile each segment; mirroring the segment as it tiles.
# tiles2: Values > 1 will tile all segments (multiplying rows when vertical=false, columns when vertical=true)
# Values < 1 will tile all segments; inverting the pattern as it tiles.
# vertical: When set to true changes the orientation from horizontal to vertical
#
# Some examples of this are:
# map = "1,1,1,false" <- This is the default; a single left->right gradient
# map = "1,1,1,true" <- Use a single top->bottom gradient instead
# map = "1,1,-5,false" <- A horizontal band wipe with 5 rows
# map = "1,5,-5,true" <- A vertical 5x5 checkerboard wipe
# map = "5,1,1,false" <- Horizontal wipe with 5 sequential bands
# map = "-5,1,1,false" <- Same as above, but each subsequent band reverses direction
#
# There are no upper / lower limits placed on segments or tiles. Some extreme settings may cause problems,
# so it is best to keep these values between -16 and + 16 or so.
#
# In addition to "a", "b", and comma-separated strings, you can also pass a clip via the map parameter. In these cases,
# The clip will be converted to grayscale and used to determine the transition. In most cases, you'll want to provide
# a still image, though interesting effects can be generated by moving clips as well. When clips are used for the map,
# they will be trimmed from frame 0 to match the duration of the transition - and the last frame held if they are
# shorter than the duration. When using still images as m, you should apply Trim(0,-1) ahead of time to optimize
# performance. Gradient map clips will be scaled (by brute force) to fit the video, so make sure that these clips
# have the same aspect ratio as the video clips, etc. Colorspace does not matter: all maps are converted to YV12
# -------------------------------------------
# duration integer, default: [automatic]
# -------------------------------------------
# This is the length of the transition in frames. By default, the wipes are 1 second long
# There is no upper limit, though excessively high values may affect the smoothness.
# of the transition on lower-resolution clips. Duration will be shortened automatically if the underlying clips do not
# have enough frames for the specified transition. If duration < 1, video (& audio) will hard-cut instead.
# ----------------------------------
# softness integer, default: 16
# ----------------------------------
# Softness determines how many levels are allowed to pass through duration animation of the gradient map.
# Higher softness settings will give a smoother appearance to the transition at the expense of precision.
# -------------------------------------
# backward boolean, default: false
# -------------------------------------
# When set to true, this will reverse the direction of the wipe. By default, dark areas transition first. A setting of
# true will cause lighter areas to transition first instead.
# -------------------------------------
# clamp boolean, default: false
# -------------------------------------
# When set to true, this will perform frame-by-frame clamping of the gradient map input to 0->255. This should be left
# at the default (false) unless an underexposed or washed-out image is used as the gradient map.
# ------------------------
# blur_pre integer, 0
# ------------------------
# This applies blurring (using AverageBlur) to the gradient map prior to animation. This can be useful at lower values
# for obscuring detail of clips to make a more even transition. At higher values (such as 50 or so) it can transform
# the map into abstract shapes, often providing unique and interesting results.
# ------------------------
# blur_post integer, 0
# ------------------------
# This applies blurring (using AverageBlur) to the animated result of the map. This can be useful as an alternative to
# or enhancement of the softness parameter - or to otherwise create a desired effect.
# -------------------------------------
# ease boolean, default: false
# -------------------------------------
# By default, transition progress will be linearly determined by the map. Set ease=true for non-linear (sine) timing.
# -------------------------------------
# xfade boolean, default: true
# -------------------------------------
# By default, clips with audio will crossfade from a->b over the duration of the tranition.
# Setting xfade=false will cause the audio to hard cut from a->b halfway through the transition.
#######################################################################################################################
GradientWipe() provides plenty of options to create an endless variety of custom wipe transitions.
#######################################################################################################################
#
# GradientWipe() 2011/12/13 by vampiredom
# -----------------------------------------------------------------------------------
# Luminance-based animated mask transitions similar to "Gradient Wipe" or "Alpha Wipe" transitions found in NLEs.
#
# Requirements: Gscript.dll
# VariableBlur.dll
#
#######################################################################################################################
#
# Usage:
# ------
# GradientWipe(clip a, clip b1 [, clip b2..b99], "map",
# \ int "duration", int "softness", bool "backward", bool "clamp"
# \ int "blur_pre", int "blur_post", bool "ease", bool "xfade"
# \)
#
# Parameters:
# ---------------------------
# a, b1 [, b2..b99] clips
# ---------------------------
# Gradient() requires between 2 and 99 clips as input. It will wipe from a to b1 [to b2, b3..]
# If you want audio output, all clips should have matching sample rate, number of channels, etc.
# If some clips contain audio while others do not, they will be conformed to match those with audio.
# Audio will cross-fade as the video wipes unless xfade=false
# --------------------------------------------------
# map string or clip [default "b"]
# --------------------------------------------------
# The map paramter sets the luminance map used for the transition. It can be a clip or a string.
# By default, map = "b" ... this will use the luminance of the b clip, so as to make a unique transition.
# When map = "a", the luminance of the a clip will be used for the transition. In addition to "a" and "b", you can
# also specify a string that will generate a gradient map as follows: map = "segments,tiles1,tiles2,vertical"
#
# The comma-separated strings are passed to the MakeGradientBands() function and are as follows, in order:
#
# segments integer [<1 or >1]
# tiles1 integer [<1 or >1]
# tiles2 integer [<1 or >1]
# vertical boolean
#
# segments: This determines how many segments the 256-level gradient will be broken into.
# The default is 1, which will make a single strip from black->white (0->255)
# When a value of 2 is used, 2 strips will be created; (0->127) and (128->255)
# A negative value causes the segments to alternate direction. For example:
# A value of -2 will create (0->127), (255->128)
# A value of -4 will create (0->63), (127->64), (128->191), (255->192)
# The segments are stacked in rows or columns [depending on the "vertical" setting]
# tiles1: Values > 1 will tile each segment (adding columns when vertical=false, rows when vertical=true)
# Values < 1 will tile each segment; mirroring the segment as it tiles.
# tiles2: Values > 1 will tile all segments (multiplying rows when vertical=false, columns when vertical=true)
# Values < 1 will tile all segments; inverting the pattern as it tiles.
# vertical: When set to true changes the orientation from horizontal to vertical
#
# Some examples of this are:
# map = "1,1,1,false" <- This is the default; a single left->right gradient
# map = "1,1,1,true" <- Use a single top->bottom gradient instead
# map = "1,1,-5,false" <- A horizontal band wipe with 5 rows
# map = "1,5,-5,true" <- A vertical 5x5 checkerboard wipe
# map = "5,1,1,false" <- Horizontal wipe with 5 sequential bands
# map = "-5,1,1,false" <- Same as above, but each subsequent band reverses direction
#
# There are no upper / lower limits placed on segments or tiles. Some extreme settings may cause problems,
# so it is best to keep these values between -16 and + 16 or so.
#
# In addition to "a", "b", and comma-separated strings, you can also pass a clip via the map parameter. In these cases,
# The clip will be converted to grayscale and used to determine the transition. In most cases, you'll want to provide
# a still image, though interesting effects can be generated by moving clips as well. When clips are used for the map,
# they will be trimmed from frame 0 to match the duration of the transition - and the last frame held if they are
# shorter than the duration. When using still images as m, you should apply Trim(0,-1) ahead of time to optimize
# performance. Gradient map clips will be scaled (by brute force) to fit the video, so make sure that these clips
# have the same aspect ratio as the video clips, etc. Colorspace does not matter: all maps are converted to YV12
# -------------------------------------------
# duration integer, default: [automatic]
# -------------------------------------------
# This is the length of the transition in frames. By default, the wipes are 1 second long
# There is no upper limit, though excessively high values may affect the smoothness.
# of the transition on lower-resolution clips. Duration will be shortened automatically if the underlying clips do not
# have enough frames for the specified transition. If duration < 1, video (& audio) will hard-cut instead.
# ----------------------------------
# softness integer, default: 16
# ----------------------------------
# Softness determines how many levels are allowed to pass through duration animation of the gradient map.
# Higher softness settings will give a smoother appearance to the transition at the expense of precision.
# -------------------------------------
# backward boolean, default: false
# -------------------------------------
# When set to true, this will reverse the direction of the wipe. By default, dark areas transition first. A setting of
# true will cause lighter areas to transition first instead.
# -------------------------------------
# clamp boolean, default: false
# -------------------------------------
# When set to true, this will perform frame-by-frame clamping of the gradient map input to 0->255. This should be left
# at the default (false) unless an underexposed or washed-out image is used as the gradient map.
# ------------------------
# blur_pre integer, 0
# ------------------------
# This applies blurring (using AverageBlur) to the gradient map prior to animation. This can be useful at lower values
# for obscuring detail of clips to make a more even transition. At higher values (such as 50 or so) it can transform
# the map into abstract shapes, often providing unique and interesting results.
# ------------------------
# blur_post integer, 0
# ------------------------
# This applies blurring (using AverageBlur) to the animated result of the map. This can be useful as an alternative to
# or enhancement of the softness parameter - or to otherwise create a desired effect.
# -------------------------------------
# ease boolean, default: false
# -------------------------------------
# By default, transition progress will be linearly determined by the map. Set ease=true for non-linear (sine) timing.
# -------------------------------------
# xfade boolean, default: true
# -------------------------------------
# By default, clips with audio will crossfade from a->b over the duration of the tranition.
# Setting xfade=false will cause the audio to hard cut from a->b halfway through the transition.
#######################################################################################################################