ISSUE-045 - Chyron Body - Added the outline to the chyron body.

It's not a perfect emulation (it fades out rather than runs out with a tail) but I'm very happy with it.
Also updated the wipe animation to take advantage of map().
This commit is contained in:
Kyle Geib committed 2022-02-11 12:24:31 -05:00
1 parent 462ea4852b
commit e6312f67e0
4 files changed
+110 -25

No files matched your search

+66 -13
View File
@@ -30,33 +30,33 @@ export function wipeCustomDegClip(
progress: Fraction,
startingCorner: Corner,
degrees: number,
): [Px, Px, Px, Px, Px, Px] {
): [[Px, Px], [Px, Px], [Px, Px]] {
const tangent = Math.tan(clamp(degrees, 0.01, 90) * Math.PI / 180);
switch (startingCorner) {
case "topLeft":
return [
0, 0,
(width + height / tangent) * progress, 0,
0, (height + width * tangent) * progress ,
[0, 0],
[(width + height / tangent) * progress, 0],
[0, (height + width * tangent) * progress ],
];
case "topRight":
return [
width, 0,
width, (height + width * tangent) * progress,
width - (width + height / tangent) * progress, 0,
[width, 0],
[width, (height + width * tangent) * progress],
[width - (width + height / tangent) * progress, 0],
];
case "bottomRight":
return [
width, height,
width, height - (height + width * tangent) * progress,
width - (width + height / tangent) * progress, height,
[width, height],
[width, height - (height + width * tangent) * progress],
[width - (width + height / tangent) * progress, height],
];
case "bottomLeft":
return [
0, height,
0, height - (height + width * tangent) * progress,
(width + height / tangent) * progress, height,
[0, height],
[0, height - (height + width * tangent) * progress],
[(width + height / tangent) * progress, height],
];
}
}
@@ -70,3 +70,56 @@ export function commonTransition(propsArray: TransitionArgs[]) {
+ ";"
);
}
export function outlineClipPath(
width: Px,
height: Px,
progress: Fraction,
outlineThickness: Px,
): [[Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px]] {
const travelDistance = width * 2 + height;
const pt1End = width / travelDistance;
const pt2End = (width + height) / travelDistance;
// Part 1: Reveal the bottom line.
if (progress <= pt1End) {
const x = width * progress / pt1End;
return [
[0, height],
[0, height],
[0, height],
[x, height],
[x, height + outlineThickness],
[0, height + outlineThickness],
];
// Part 2: Reveal the right line.
} else if (progress > pt1End && progress <= pt2End) {
const y = height - (height + outlineThickness) * ((progress - pt1End) / (pt2End - pt1End));
return [
[0, height],
[width - 10, height],
[width, y],
[width + outlineThickness, y],
[width + outlineThickness, height + outlineThickness],
[0, height + outlineThickness],
];
// Part 3: Reveal the top line.
} else {
const x = width - width * ((progress - pt2End) / (1 - pt2End));
return [
[0, height],
[x - 10, height],
[x, -outlineThickness],
[width + outlineThickness, -outlineThickness],
[width + outlineThickness, height + outlineThickness],
[0, height + outlineThickness],
];
}
// return [
// ]
}