Skip to content

Cinematics

Gugas749 edited this page Nov 16, 2026 · 1 revision

Cinematics

Timelines that take over the screen and the camera: letterbox bars, darkening, vignettes, flashes, subtitles and titles, a hidden HUD, a camera that orbits the player or pulls back, shake, FOV punches, a locked view, a full-bright player. This is the engine behind AbyssOrigins' ascension and "I Am Atomic" cinematics, made generic.

import com.gugas749.abysscore.api.cinematic.*;   // AbyssCinematic, AbyssCinematics, Keyframes, Ease, CinematicText

Keyframes

Everything that changes over time is a Keyframes (time = ticks since the cinematic started). Before the first key it holds the first value, after the last key the last value; each key's Ease shapes the way into it.

Keyframes.of(1f)                                              // constant
Keyframes.start(0).to(20, 1, Ease.SMOOTH).to(60, 0).build()   // 0 -> 1 in a second, back to 0 at tick 60
Keyframes.startAt(40, 0).to(41, 1).hold(80).to(100, 0, Ease.OUT).build()
Keyframes.window(0, 200, 12, 20, 0.12f)                       // fade in over 12 ticks, hold 0.12, fade out by 200
Keyframes.pulse(90, 1f, 2, 16)                                // flash: peak at tick 92, gone by 108

Ease: LINEAR, SMOOTH, IN, OUT, IN_OUT, STEP.

Building a cinematic

int total = 170, burst = 90;
AbyssCinematic c = AbyssCinematic.builder("mymod:ascend", total)    // id: playing it again restarts it
        .focus(player)                                              // the camera moves around this player
        .hideHud(4, total - 10)
        .lockView(0, burst + 40)                                    // mouse doesn't turn them; neutral speed-FOV
        .fullBright(0, burst + 40)                                  // drawn lit by their own energy
        .fill(0x07050F, Keyframes.start(0).to(30, 0.38f, Ease.SMOOTH).to(burst, 0.38f).to(burst + 10, 0).build())
        .vignette(0x000000, 0.33f, Keyframes.window(0, total, 12, 22, 0.85f))
        .flash(0xF6F2FF, burst, 0.95f, 16)                          // white-out at the burst
        .letterbox(Keyframes.window(0, total, 12, 22, 0.12f))
        .text(CinematicText.translatable("mymod.ascend.line"), AbyssCinematic.TextAnchor.SUBTITLE,
                0xE4DAFF, 1.4f, 16, burst - 4, 5)                   // in the bottom bar
        .title(CinematicText.literal("Noble Vampire"), 0xFFE0E6, 2.5f, burst + 8, total - 12, 8, 8)
        .orbit(Keyframes.start(160).to(total - 30, 380, Ease.IN_OUT).build(),     // yaw around them
               Keyframes.start(18).to(burst, 4, Ease.SMOOTH).to(total - 30, 12).build(),  // pitch
               Keyframes.start(8).to(burst, 4.5f).to(total - 30, 10, Ease.OUT).build(),   // distance
               Keyframes.window(0, total - 2, 18, 22, 1))                         // blend with their own view
        .shake(Keyframes.startAt(burst, 0).to(burst + 1, 1.6f).to(burst + 20, 0, Ease.OUT).build(), 1f)
        .fov(Keyframes.start(1).to(burst, 0.92f, Ease.SMOOTH).to(burst + 3, 1.12f).to(burst + 33, 1, Ease.SMOOTH).build())
        .build();
Element Who sees it Description
letterbox(size) everyone it's sent to Black bars; size = fraction of the screen height per bar (0.12 = cinema)
fill(rgb, alpha) everyone Whole-screen tint (darken, colour wash)
flash(rgb, at, strength, decay) everyone A fill with a pulse
vignette(rgb, size, alpha) everyone Edges towards rgb; size = fade width (fraction of the height)
text(text, anchor, rgb, scale, from, to, fade) everyone TextAnchor.TOP / TITLE / CENTER / SUBTITLE (centred in the bottom bar)
title(text, rgb, scale, from, to, fade, rise) everyone TITLE text that rises rise px into place while it fades in
hideHud(from, to) everyone Hides the HUD (chat stays) - also AbyssCore's corruption bar and vanish HUD
shake(amplitude, speed) everyone Camera tremor in degrees; speed 1 = nervous, 0.3 = slow sway
fov(multiplier) everyone 0.9 = zoom in, 1.15 = punch out
camera(mode, from, to) focus player CameraMode.FIRST_PERSON / THIRD_PERSON_BACK / THIRD_PERSON_FRONT; their own view comes back after
orbit(yaw, pitch, distance, weight) focus player yaw: degrees around them from the way they faced at the start (0 = behind, 180 = in front); pitch: + looks down; distance: blocks; weight 0..1 = blend with their own view. Third person while the weight is above 0.
pullBack(distance, weight) focus player An orbit without angles: pulls the third-person camera back (or in)
lockView(from, to) focus player Holds their view direction, neutral speed-FOV
fullBright(from, to) everyone The focus entity is drawn full-bright

Text is a CinematicText (literal("...") or translatable("key", "arg"...)), plain data so it travels the same way on both versions. When the orbit ends and the player was in first person, the camera closes in on their eyes before it hands the view back. The camera keeps out of walls like vanilla's.

Playing it (server)

AbyssCinematics.play(player, c);                       // one viewer
AbyssCinematics.play(players, c);                      // several
AbyssCinematics.playNear(level, pos, 24, c);           // everyone within 24 blocks (+ the focus player)
AbyssCinematics.stop(player, "mymod:ascend");
AbyssCinematics.stopAll(player);

// Sync server work to the timeline (runs on the server thread after N ticks)
AbyssCinematics.schedule(server, burst, () -> AbyssVfx.burst(level, player.position().add(0, 1, 0), 2, 0x9B6BFF, 0xE0D0FF));

// An earthquake: shake for everyone within radius * 2, fading with distance and time
AbyssCinematics.quake(level, pos, 8, 40, 1f);

A cinematic is the same object for every viewer: the viewer that is the focus gets the camera elements, everyone else gets the screen layers, shake and FOV. One template for many players: c.withFocus(otherPlayer).

Client side

AbyssCinematicsClient.play(c) plays one on this client only, stop(id), stopAll(), isPlaying([id]), age(id, partialTick) (ticks since it started, or -1 - handy to sync your own animations, e.g. a pose), and hudHidden() (true while one hides the HUD - check it in your own HUD layers if they aren't vanilla-layer based).

Clone this wiki locally