Skip to main content

GpuAnimationBatch

Struct GpuAnimationBatch 

Source
pub struct GpuAnimationBatch { /* private fields */ }
Expand description

Batch of Tween<f32> values evaluated together.

The public API is intentionally small: push tweens, tick the batch, then read the current values. The CPU fallback preserves exact Tween<f32> behavior, including delays, looping, and advanced/custom easing.

Implementations§

Source§

impl GpuAnimationBatch

Source

pub fn new_cpu() -> Self

Create a CPU-only batch.

Source

pub fn new(device: Device, queue: Queue) -> Result<Self, GpuBatchError>

Create a batch from an existing wgpu device and queue.

If an unsupported easing is pushed later, backend reports GpuBackend::Cpu and ticks continue through the exact CPU fallback path.

Source

pub fn try_new_auto() -> Result<Self, GpuBatchError>

Try to create a GPU-backed batch using the default wgpu adapter.

Source

pub fn new_auto() -> Self

Create a GPU-backed batch when possible, otherwise return CPU fallback.

This function never panics because GPU availability is environmental.

Source

pub fn push(&mut self, tween: Tween<f32>) -> usize

Push a tween and return its batch index.

Source

pub fn tick(&mut self, dt: f32)

Advance every tween by dt seconds and refresh the output buffer.

Source

pub fn read_back(&self) -> &[f32]

Current output values, in insertion order.

Source

pub fn backend(&self) -> GpuBackend

Currently active backend.

Source

pub fn len(&self) -> usize

Number of tweens in the batch.

Source

pub fn is_empty(&self) -> bool

true when the batch contains no tweens.

Source

pub fn clear(&mut self)

Remove all tweens and output values.

Source

pub fn shader_source() -> &'static str

WGSL shader source used by the GPU backend.

Trait Implementations§

Source§

impl Debug for GpuAnimationBatch

Source§

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

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

impl Default for GpuAnimationBatch

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,