Skip to content

lightRays ​

Draws the picture's highlights out into shafts of light from a point.

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

// lightRays: Draws the picture's highlights out into shafts of light from a point.
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: "lightRays",
              center: [0.85, 0.1],
              threshold: 0.7,
              intensity: [
                { at: 0.5, value: 0, easing: "easeInOut" },
                { at: 1.5, value: 2.2 },
              ],
            },
          ]}
        />
      </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
center[number, number][0.5,0.5]Where the light comes from, as [x, y] fractions of the frame from the top left.
lengthnumber (0..4000)240How long the rays are at the corner farthest from the centre, in pixels; they shorten toward it.
thresholdnumber (0..1)0.6The brightness the rays start from, 0 to 1: only what is brighter throws a ray.
intensitynumber (0..4)1How strong the rays are, as a multiplier; 0 leaves the picture as it was.

All effects and transitions · Units

MIT licensed.