pub struct ClosureBehaviour<T, P, S>where
T: Clone + Send + Sync,
P: Fn(&mut T, &mut RenderableParams, Duration, &Scene, Point<isize>) + Clone + Send + Sync,
S: Fn(&T, &Img, Point<f64>, Duration, Point<isize>) -> Rgba<u8> + Clone + Send + Sync,{
pub data: T,
pub process: P,
pub shader: S,
}Expand description
Ex:
use shanimation_rs::prelude::*;
ClosureRenderable {
data: (),
process: |data, params, time, scene, abs_position| {
params.rotation = time.as_secs_f64() * 2.0;
},
shader: |data, frame, uv, time, abs_position| -> Rgba<u8> {
let p = uv.map_both(|v| (v * 255.0) as u8);
Rgba([255, p.x, p.y, 255])
},
};Fields§
§data: T§process: P§shader: STrait Implementations§
source§impl<T, P, S> Behaviour for ClosureBehaviour<T, P, S>where
T: Clone + Send + Sync,
P: Fn(&mut T, &mut RenderableParams, Duration, &Scene, Point<isize>) + Clone + Send + Sync,
S: Fn(&T, &Img, Point<f64>, Duration, Point<isize>) -> Rgba<u8> + Clone + Send + Sync,
impl<T, P, S> Behaviour for ClosureBehaviour<T, P, S>where T: Clone + Send + Sync, P: Fn(&mut T, &mut RenderableParams, Duration, &Scene, Point<isize>) + Clone + Send + Sync, S: Fn(&T, &Img, Point<f64>, Duration, Point<isize>) -> Rgba<u8> + Clone + Send + Sync,
source§impl<T, P, S> Clone for ClosureBehaviour<T, P, S>where
T: Clone + Send + Sync + Clone,
P: Fn(&mut T, &mut RenderableParams, Duration, &Scene, Point<isize>) + Clone + Send + Sync + Clone,
S: Fn(&T, &Img, Point<f64>, Duration, Point<isize>) -> Rgba<u8> + Clone + Send + Sync + Clone,
impl<T, P, S> Clone for ClosureBehaviour<T, P, S>where T: Clone + Send + Sync + Clone, P: Fn(&mut T, &mut RenderableParams, Duration, &Scene, Point<isize>) + Clone + Send + Sync + Clone, S: Fn(&T, &Img, Point<f64>, Duration, Point<isize>) -> Rgba<u8> + Clone + Send + Sync + Clone,
source§fn clone(&self) -> ClosureBehaviour<T, P, S>
fn clone(&self) -> ClosureBehaviour<T, P, S>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T, P, S> RefUnwindSafe for ClosureBehaviour<T, P, S>where P: RefUnwindSafe, S: RefUnwindSafe, T: RefUnwindSafe,
impl<T, P, S> Send for ClosureBehaviour<T, P, S>
impl<T, P, S> Sync for ClosureBehaviour<T, P, S>
impl<T, P, S> Unpin for ClosureBehaviour<T, P, S>where P: Unpin, S: Unpin, T: Unpin,
impl<T, P, S> UnwindSafe for ClosureBehaviour<T, P, S>where P: UnwindSafe, S: UnwindSafe, T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more