# These are the set of transition names from the ffmpeg xfade filter that we allow.
# These are the set of transition names from the ffmpeg xfade filter that we allow.
# This is mainly here to prevent someone putting in arbitrary strings and causing weird problems.
# This is mainly here to prevent someone putting in arbitrary strings and causing weird problems,
KNOWN_XFADE_TRANSITIONS=[
# and to provide descriptions.
"fade",
# See https://trac.ffmpeg.org/wiki/Xfade for examples.
"wipeleft",
KNOWN_XFADE_TRANSITIONS={
"wiperight",
"fade":"A simple cross-fade.",
"wipeup",
"fadeblack":"A fade to black then to the new video.",
"wipedown",
"fadewhite":"A fade to white then fade to the new video.",
"slideleft",
"fadegrays":"The old video fades to grayscale then to the new video.",
"slideright",
"wipeleft":"A wipe from right to left.",
"slideup",
"wiperight":"A wipe from left to right.",
"slidedown",
"wipeup":"A wipe from bottom to top.",
"circlecrop",
"wipedown":"A wipe from top to bottom.",
"rectcrop",
"slideleft":"The old video slides left as the new video comes in from the right.",
"distance",
"slideright":"The old video slides right as the new video comes in from the left.",
"fadeblack",
"slideup":"The old video slides up as the new video comes in from the bottom.",
"fadewhite",
"slidedown":"The old video slides down as the new video comes in from the top.",
"radial",
"circlecrop":"Circular black mask comes in from edges to center, then out again with new video.",
"smoothleft",
"rectcrop":"Rectangular black mask comes in from edges to center, then out again with new video.",
"smoothright",
"distance":"???",
"smoothup",
"radial":"Similar to clock wipe, but with a cross-fading line.",
"smoothdown",
"smoothleft":"Similar to wipe left, but with a cross-fading line.",
"circleopen",
"smoothright":"Similar to wipe right, but with a cross-fading line.",
"circleclose",
"smoothup":"Similar to wipe up, but with a cross-fading line.",
"vertopen",
"smoothdown":"Similar to wipe down, but with a cross-fading line.",
"vertclose",
"circleopen":"Circular wipe from outside in, with a cross-fading line.",
"horzopen",
"circleclose":"Circular wipe from inside out, with a cross-fading line.",
"horzclose",
"vertopen":"Wipe from center to either side, with a cross-fading line.",
"dissolve",
"vertclose":"Wipe from either side to center, with a cross-fading line.",
"pixelize",
"horzopen":"Wipe from center to top and bottom, with a cross-fading line.",
"diagtl",
"horzclose":"Wipe from top and bottom to center, with a cross-fading line.",
"diagtr",
"dissolve":"Similar to a fade, but each pixel changes instantly, more pixels change over time.",
"diagbl",
"pixelize":"Pixelates the image, switches to new video, then unpixelates.",
"diagbr",
# TODO the rest later
"hlslice",
"diagtl":"",
"hrslice",
"diagtr":"",
"vuslice",
"diagbl":"",
"vdslice",
"diagbr":"",
"hblur",
"hlslice":"",
"fadegrays",
"hrslice":"",
"wipetl",
"vuslice":"",
"wipetr",
"vdslice":"",
"wipebl",
"hblur":"",
"wipebr",
"wipetl":"",
"squeezeh",
"wipetr":"",
"squeezev",
"wipebl":"",
"zoomin",
"wipebr":"",
"fadefast",
"squeezeh":"",
"fadeslow",
"squeezev":"",
"hlwind",
"zoomin":"",
"hrwind",
"hlwind":"",
"vuwind",
"hrwind":"",
"vdwind",
"vuwind":"",
"coverleft",
"vdwind":"",
"coverright",
"coverleft":"",
"coverup",
"coverright":"",
"coverdown",
"coverup":"",
"revealleft",
"coverdown":"",
"revealright",
"revealleft":"",
"revealup",
"revealright":"",
"revealdown",
"revealup":"",
]
"revealdown":"",
"fadefast":"???",
"fadeslow":"???",
}
# These are custom transitions implemented using xfade's custom transition support.
# These are custom transitions implemented using xfade's custom transition support.
# It maps from name to the "expr" value to use.
# It maps from name to (description, expr).
# In these expressions:
# In these expressions:
# X and Y are pixel coordinates
# X and Y are pixel coordinates
# A and B are the old and new video's pixel values
# A and B are the old and new video's pixel values
# W and H are screen width and height
# W and H are screen width and height
# P is a "progress" number from 0 to 1 that increases over the course of the wipe
# P is a "progress" number from 0 to 1 that increases over the course of the wipe
CUSTOM_XFADE_TRANSITIONS={
CUSTOM_XFADE_TRANSITIONS={
# A clock wipe is a 360 degree clockwise sweep around the center of the screen, starting at the top.
"clockwipe":(
# It is intended to mimic an analog clock and insinuate a passing of time.
"A 360 degree clockwise sweep around the center of the screen, starting at the top.\n"
# It is implemented by calculating the angle of the point off a center line (using atan2())
"Intended to mimic an analog clock and insinuate a passing of time.",
# then using the new video if progress > that angle (normalized to 0-1).
# Implemented by calculating the angle of the point off a center line (using atan2())
"clockwipe":"if(lt((1-atan2(W/2-X,Y-H/2)/PI) / 2, P), A, B)",
# then using the new video if progress > that angle (normalized to 0-1).
# The classic star wipe is an expanding 5-pointed star from the center.
"if(lt((1-atan2(W/2-X,Y-H/2)/PI) / 2, P), A, B)",
# It's mostly a meme.
),
# It is implemented by converting to polar coordinates (distance and angle off center),
"starwipe":(
# then comparing distance to a star formula derived from here: https://math.stackexchange.com/questions/4293250/how-to-write-a-polar-equation-for-a-five-pointed-star
"Wipe using an expanding 5-pointed star from the center. Mostly a meme.",
# Made by SenseAmidstMadness.
# Implemented by converting to polar coordinates (distance and angle off center),
# then comparing distance to a star formula derived from here: https://math.stackexchange.com/questions/4293250/how-to-write-a-polar-equation-for-a-five-pointed-star