Skip to main content

Camera

Struct Camera 

Source
pub struct Camera {
    pub x: f32,
    pub y: f32,
    pub zoom: f32,
    pub rotation: f32,
    pub origin: Option<CameraOrigin>,
    pub focus: f32,
    pub aperture: f32,
    pub rotate_x: f32,
    pub rotate_y: f32,
    pub perspective: f32,
    pub keyframes: Vec<CameraKeyframe>,
    pub motion_blur: Option<CameraMotionBlurConfig>,
}
Expand description

Virtual camera for pan/zoom/rotation effects at the scene level.

Fields§

§x: f32

Camera center X offset from scene center (pixels). Default: 0.

§y: f32

Camera center Y offset from scene center (pixels). Default: 0.

§zoom: f32

Zoom factor. 1.0 = no zoom, 2.0 = 2x zoom in, 0.5 = zoom out.

§rotation: f32

Rotation in degrees around the camera origin. Default: 0.

§origin: Option<CameraOrigin>

Focal point for zoom/rotation, in frame pixels. Absent = frame centre (the historical behaviour). When the object is present, x/y default to 0 (top-left corner) — set both explicitly.

§focus: f32

Depth the camera is focused on, on the same scale as style.depth. Default 1.0 — the plane an element sits on when it declares no depth, so a scenario that never mentions focus is focused on everything it has.

§aperture: f32

How fast sharpness falls off away from focus, in blur pixels per unit of depth difference. Default 0.0 — no depth of field at all, which is what every scenario written before this rendered. 4.0 is a visible but readable separation; past 20.0 an out-of-focus plane reads as a colour wash.

Animate focus through keyframes for a rack focus; animating aperture instead opens and closes the effect without moving the focal plane.

§rotate_x: f32

Tilt of the whole shot about the horizontal axis, in degrees, applied to each direct child of the scene scaled by its style.depth — the same rule parallax and focus already follow. Default 0.

§rotate_y: f32

Tilt about the vertical axis, same convention. Default 0.

§perspective: f32

Viewing distance for rotate_x/rotate_y, in pixels. One vanishing point for the whole shot — which is the difference from copying the same rotation onto every group, where each group gets its own. 0 means no perspective, an orthographic tilt. Default 0.

§keyframes: Vec<CameraKeyframe>

Keyframe animations for camera properties.

§motion_blur: Option<CameraMotionBlurConfig>

Blurs the frame across a shutter window when the camera itself is moving (pan, zoom, rotation or shake) — opt-in, since it renders samples sub-frame exposures and averages them instead of one. Absent (the default) renders exactly as before. Skipped on any frame where the resolved camera pose does not change across the window, so a static shot never pays the extra cost.

Implementations§

Source§

impl Camera

Source

pub fn resolve_property(&self, property: &str, time: f64) -> f32

Trait Implementations§

Source§

impl Clone for Camera

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Camera

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Camera

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Camera

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Camera

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.