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.
| param | type | default | description |
|---|---|---|---|
src | string | The map, as "asset:<id>": an image in the manifest. Its red moves the picture sideways, its green up and down. | |
x | number (-1000..1000) | 20 | How far full red (right) or no red (left) moves the picture, in pixels. |
y | number (-1000..1000) | 20 | How far full green (down) or no green (up) moves the picture, in pixels. |