pub struct RipplePresentation {
pub origin: [f32; 2],
pub radius: f32,
pub opacity: f32,
}Expand description
A deterministic circular ripple for a pressed visual presentation.
This sample affects drawing only. It does not dispatch input, activate the surface, or start a ripple animation.
use tessera_components::{
button::button,
modifier::{InteractionState, InteractionVisualState},
surface::RipplePresentation,
theme::material_theme,
};
use tessera_ui::{remember, tessera};
#[tessera]
fn sample() {
let live = remember(InteractionState::new);
material_theme().child(move || {
button()
.interaction_state(live)
.presentation_state(InteractionVisualState::Pressed)
.presentation_ripple(RipplePresentation {
origin: [0.75, 1.0],
radius: 0.7,
opacity: 0.1,
});
assert_eq!(live.get(), InteractionState::new());
});
}Fields§
§origin: [f32; 2]Origin relative to the surface: [0, 0] is the top-left corner and
[1, 1] is the bottom-right corner. Origins may lie outside the
surface. Non-finite coordinates use the center; coordinates are
bounded to [-1024, 1024].
radius: f32Radius in multiples of the surface’s shorter dimension, bounded to
[0, 1024]. Non-finite or negative radii produce no ripple.
opacity: f32Ripple opacity in [0, 1]. Non-finite or negative opacity produces no
ripple.
Trait Implementations§
Source§impl Clone for RipplePresentation
impl Clone for RipplePresentation
Source§fn clone(&self) -> RipplePresentation
fn clone(&self) -> RipplePresentation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RipplePresentation
Source§impl Debug for RipplePresentation
impl Debug for RipplePresentation
Source§impl Default for RipplePresentation
impl Default for RipplePresentation
Source§fn default() -> RipplePresentation
fn default() -> RipplePresentation
Returns the “default value” for a type. Read more
Source§impl PartialEq for RipplePresentation
impl PartialEq for RipplePresentation
impl StructuralPartialEq for RipplePresentation
Auto Trait Implementations§
impl Freeze for RipplePresentation
impl RefUnwindSafe for RipplePresentation
impl Send for RipplePresentation
impl Sync for RipplePresentation
impl Unpin for RipplePresentation
impl UnsafeUnpin for RipplePresentation
impl UnwindSafe for RipplePresentation
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.