Skip to content

threshold ​

Cuts the picture to two colours, by brightness.

tsx
import { Clip, Composition, Track } from "@uberscene/kit";

// threshold: Cuts the picture to two colours, by brightness.
export default function Video() {
  return (
    <Composition fps={30} width={640} height={360}>
      <Track id="main">
        <Clip
          id="shot"
          src="asset:redCup"
          in={18}
          out={21}
          fit="cover"
          effects={[
            {
              type: "threshold",
              level: 0.42,
              dark: "#20160f",
              light: "#f4efe6",
              amount: [
                { at: 0.5, value: 0, easing: "easeInOut" },
                { at: 1.5, value: 1 },
              ],
            },
          ]}
        />
      </Track>
    </Composition>
  );
}

The coffee footage is Pixabay videos 209419, 209424, 46989 and 251, under the Pixabay Content License. The maker of the machine in the red cup shot has nothing to do with this project.

Params ​

Drawn as a shader.

paramtypedefaultdescription
levelnumber (0..1)0.5The brightness that divides the two colours, 0 to 1: brighter pixels turn light, darker ones dark.
softnessnumber (0..1)0How much brightness the fade between the two colours covers, about the level; 0 is a hard cut.
darkstring"#000000"The colour of the pixels darker than the level.
lightstring"#ffffff"The colour of the pixels brighter than the level.
amountnumber (0..1)1How much of the effect to mix in: 0 leaves the picture as it was, 1 is the full effect.

All effects and transitions · Units

MIT licensed.