Class CameraZoom
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.camera.CameraZoom
Zooms the camera: a spyglass of a mod's own, a scope, a lens. The view narrows smoothly to the zoom asked for, and
the mouse slows by as much, so aiming stays as steady at 4x as at 1x.
CameraZoom.set(3.0F); // three times closer; eases in
CameraZoom.reset(); // back to the player's own field of view
// The wheel zooms while the lens is raised (and scrolls the hotbar as usual when it is not).
CameraZoom.scroll(() -> MyLens.isRaised(), 1.0F, 4.0F, 0.5F);
Zoom is client state. Whoever sets it resets it: an item raised sets it each tick it is raised and resets it when
lowered. It is cleared when the player leaves the world.-
Method Summary
Modifier and TypeMethodDescriptionstatic floatcurrent()The zoom as drawn this tick, on its way totarget().static voidease(float perTick) How quickly the view eases to the zoom asked for: the share of the way left that it covers each tick.static voidreset()Back to the player's own view.static voidscroll(@Nullable BooleanSupplier active, float min, float max, float step) Lets the mouse wheel zoom.static voidset(float factor) Zooms to a factor: 1 is the player's own view, 2 shows half as wide a field.static floattarget()The zoom being eased towards.
-
Method Details
-
set
public static void set(float factor) Zooms to a factor: 1 is the player's own view, 2 shows half as wide a field. Eases there over a few ticks. -
ease
public static void ease(float perTick) How quickly the view eases to the zoom asked for: the share of the way left that it covers each tick. 0.35 by default (snappy); around 0.15 is a slow, heavy lens; 1 is instant. -
reset
public static void reset()Back to the player's own view. -
target
public static float target()The zoom being eased towards. -
current
public static float current()The zoom as drawn this tick, on its way totarget(). -
scroll
Lets the mouse wheel zoom. Whileactivesays so (and no screen is open), a notch of the wheel changes the zoom bystepbetweenminandmax, and does nothing else. One wheel control at a time: a second call replaces the first.- Parameters:
active- when the wheel zooms; null removes the control
-