Skip to content

displacementMap ​

Moves the picture's pixels by the colours of a map image: glass, water or heat.

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

// displacementMap: Moves the picture's pixels by the colours of a map image: glass, water or heat.
export default function Video() {
  return (
    <Composition fps={30} width={640} height={360}>
      <Track id="main">
        <Clip
          id="shot"
          src="asset:coffee"
          in={12}
          out={15}
          fit="cover"
          effects={[
            {
              type: "displacementMap",
              src: "asset:ripples",
              x: [
                { at: 0.5, value: 0, easing: "easeInOut" },
                { at: 1.5, value: 14 },
              ],
              y: [
                { at: 0.5, value: 0, easing: "easeInOut" },
                { at: 1.5, value: 14 },
              ],
            },
          ]}
        />
      </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
srcstringThe map, as "asset:<id>": an image in the manifest. Its red moves the picture sideways, its green up and down.
xnumber (-1000..1000)20How far full red (right) or no red (left) moves the picture, in pixels.
ynumber (-1000..1000)20How far full green (down) or no green (up) moves the picture, in pixels.

All effects and transitions · Units

MIT licensed.