Skip to content

lensDistortion ​

Bends the picture as a lens does: a barrel's bulge, or a pincushion's pinch.

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

// lensDistortion: Bends the picture as a lens does: a barrel's bulge, or a pincushion's pinch.
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: "lensDistortion",
              amount: [
                { at: 0.5, value: 0, easing: "easeInOut" },
                { at: 1.5, value: 0.6 },
              ],
            },
          ]}
        />
      </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
amountnumber (-1..1)0.4How much the lens bends the picture: 1 the strongest barrel, negative a pincushion, 0 leaves it straight.
zoomnumber (0.1..10)1How much the bent picture is magnified about the centre, as a multiplier; 1 leaves its size.

All effects and transitions · Units

MIT licensed.