Skip to content

pixelate ​

Turns the picture, or a box of it, into a coarse mosaic.

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

// pixelate: Turns the picture, or a box of it, into a coarse mosaic.
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">
          <Effect id="look" type="pixelate" params={{ box: [0.66, 0, 0.34, 1] }}>
            <Keyframe id="k1" param="size" at={0.5} value={1} />
            <Keyframe id="k2" param="size" at={1.5} value={18} 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
sizenumber (1..200)12How big each mosaic cell is, in pixels; 1 leaves the picture as it was.
box[number, number, number (> 0), number (> 0)][0,0,1,1]The part of the frame to pixelate, as [x, y, width, height] fractions of the frame from the top left.
feathernumber (0..500)0How far in from the box's edge the mosaic fades in, in pixels.

All effects and transitions · Units

MIT licensed.