.dev

Modules1 min read

Camera

Shake, FOV punch, look-at, letterbox, fades and keyframed cutscenes.

camera:1Tier A · Decorate

Good for

  • Map fly-overs before a match
  • Hit feedback with shake and FOV punch
  • Cinematic story moments with letterbox and fades

Try it in game, no code

/tehoapi shake * 0.8 500

Camera effects make moments land: a shake on an explosion, a FOV punch on a hit, a cutscene when a match starts. Everything respects the player's reduced-motion setting, so players who turn motion down get a gentler version or none at all.

Effects

Java
teho.camera().shake(0.6, 400, 18);
teho.camera().fovPunch(8, 250);
teho.camera().lookAt(0.5, 80, 0.5, 600, 1500);
teho.camera().lookAt(boss.getUniqueId(), 400, 2000);
teho.camera().letterbox(true, 0.12, 300);
teho.camera().fade(0xFF000000, 300, 800, 500);
MethodArguments
shake(intensity, durationMs, frequency)Intensity from 0 to 10, up to 30 seconds, frequency from 0.01 to 60 shakes per second.
fovPunch(degrees, durationMs)A quick FOV kick of up to ±60 degrees that eases back.
lookAt(x, y, z, turnMs, holdMs) / lookAt(entity, turnMs, holdMs)Turns the camera toward a point or entity, then holds.
letterbox(on, size, fadeMs)Cinematic bars, size as a fraction of screen height up to 0.4.
fade(argb, inMs, holdMs, outMs)A full-screen fade to a colour and back.

Cutscenes

A cutscene is a list of keyframes that the client plays locally, smoothly, with no server ticks involved.

Java
teho.camera().cutscene(Cutscene.builder("intro")
        .frame(0, 0, 90, -40, 0, 20)
        .frame(4000, 40, 80, 0, 90, 10, 0, 70, Cutscene.Ease.SMOOTH_PATH)
        .frame(8000, 0, 70, 40, 180, 0, 0, 70, Cutscene.Ease.IN_OUT)
        .skippable(true)
        .hideHud(true)
        .letterbox(true)
        .dimension("overworld")
        .build());

frame(atMs, x, y, z, yaw, pitch) is the short form. The long form adds roll, fov (0 to 170) and the easing into this frame: LINEAR, IN_OUT, IN, OUT or SMOOTH_PATH, which runs a curve through the frames instead of straight lines. A cutscene needs at least two frames and holds up to 256. loop(true) repeats it until you stop it.

Java
teho.camera().stopCutscene("intro");

When a cutscene finishes or the player skips it, you get TehoListener.onCutsceneEnded(player, id, skipped).

No code

Text
/tehoapi shake * 0.8 500
/tehoapi fade * #000000
/tehoapi letterbox * on