Skip to content

colorKey ​

Makes one colour transparent: a green screen.

tsx
import { Clip, Composition, Effect, Keyframe, Track } from "@cutcraft/kit";

// colorKey: Makes one colour transparent: a green screen.
export default function Video() {
  return (
    <Composition fps={30} width={640} height={360}>
      <Track id="main">
        <Clip id="shot" src="asset:coffeeWide" in={4} out={7} fit="cover" />
      </Track>
      <Track id="keyed">
        <Clip id="greenscreen" src="asset:greenscreen" in={0} out={3} fit="cover">
          <Effect id="look" type="colorKey" params={{ color: "#00b140" }}>
            <Keyframe id="k1" param="tolerance" at={0.5} value={0} />
            <Keyframe id="k2" param="tolerance" at={1.5} value={0.3} easing="ease-in-out" />
          </Effect>
        </Clip>
      </Track>
    </Composition>
  );
}

The coffee footage is Pixabay videos 209419 and 209424, under the Pixabay Content License.

Params ​

Drawn as a shader.

paramtypedefaultdescription
colorstring"#00ff00"The colour to key out: the screen's colour.
tolerancenumber (0..1)0.3How far a colour may lie from the key colour and still be removed fully.
softnessnumber (0..1)0.1How wide the fade is between removed and kept colours, past tolerance.
spillnumber (0..1)0.5How much of the screen's light bounced onto the subject to take out: 0 keeps it, 1 removes it fully.

All effects and transitions · Units

MIT licensed.