pub struct CompositionPropertySet { /* private fields */ }Expand description
Property sets are composition objects that allow storage of key values pairs that can be shared across the application and are not tied to the lifetime of another composition object. Property sets are most commonly used with animations, where they maintain key-value pairs that are referenced to drive portions of composition animations. Property sets provide the ability to insert key-value pairs or retrieve a value for a given key. A property set does not support a delete function – ensure you use property sets to store values that will be shared across the application.
A property set made with new (or Compositor::create_property_set) is live,
as in WinUI: it has a server counterpart that receives its entries with each batch, its
entries can be animated with start_animation, and an expression that refers to it reads
its current values. Upstream’s property sets live on the UI thread only, and an expression
sees a copy of them taken when its animation starts; the parameters of an animation are such
a set (see docs/porting/winui-composition.md).
Implementations§
Source§impl CompositionPropertySet
impl CompositionPropertySet
Sourcepub fn new(compositor: &Rc<Compositor>) -> Rc<CompositionPropertySet>
pub fn new(compositor: &Rc<Compositor>) -> Rc<CompositionPropertySet>
Creates a live property set (Compositor.CreatePropertySet).
pub fn compositor(&self) -> &Rc<Compositor>
pub fn insert_color(&self, property_name: &str, value: Color)
pub fn insert_matrix3x2(&self, property_name: &str, value: Matrix3x2)
pub fn insert_matrix4x4(&self, property_name: &str, value: Matrix4x4)
pub fn insert_quaternion(&self, property_name: &str, value: Quaternion)
pub fn insert_scalar(&self, property_name: &str, value: f32)
pub fn insert_vector2(&self, property_name: &str, value: Vector2)
pub fn insert_vector3(&self, property_name: &str, value: Vector3)
pub fn insert_vector4(&self, property_name: &str, value: Vector4)
pub fn try_get_color( &self, property_name: &str, ) -> (CompositionGetValueStatus, Color)
pub fn try_get_matrix3x2( &self, property_name: &str, ) -> (CompositionGetValueStatus, Matrix3x2)
pub fn try_get_matrix4x4( &self, property_name: &str, ) -> (CompositionGetValueStatus, Matrix4x4)
pub fn try_get_quaternion( &self, property_name: &str, ) -> (CompositionGetValueStatus, Quaternion)
pub fn try_get_scalar( &self, property_name: &str, ) -> (CompositionGetValueStatus, f32)
pub fn try_get_vector2( &self, property_name: &str, ) -> (CompositionGetValueStatus, Vector2)
pub fn try_get_vector3( &self, property_name: &str, ) -> (CompositionGetValueStatus, Vector3)
pub fn try_get_vector4( &self, property_name: &str, ) -> (CompositionGetValueStatus, Vector4)
pub fn insert_boolean(&self, property_name: &str, value: bool)
pub fn try_get_boolean( &self, property_name: &str, ) -> (CompositionGetValueStatus, bool)
Trait Implementations§
Source§impl AsCompositionObject for CompositionPropertySet
impl AsCompositionObject for CompositionPropertySet
Source§fn as_composition_object(&self) -> &CompositionObject
fn as_composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn composition_type_name(&self) -> &'static str
fn composition_type_name(&self) -> &'static str
Source§fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
is CompositionPropertySet test of upstream).Source§impl ICompositionObjectAnimations for CompositionPropertySet
impl ICompositionObjectAnimations for CompositionPropertySet
Source§fn try_start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
) -> bool
fn try_start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, ) -> bool
Starts an animation of an entry of a live set. As in WinUI the entry must have been inserted first; the animation starts from its current value.
Source§fn get_composition_property(
&self,
property_name: &str,
) -> Option<&'static CompositionProperty>
fn get_composition_property( &self, property_name: &str, ) -> Option<&'static CompositionProperty>
Source§fn composition_object(&self) -> &CompositionObject
fn composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
)
fn start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, )
Source§fn start_animation_with_final_value(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
)
fn start_animation_with_final_value( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, )
start_animation. property_name may
name a sub-channel of a vector property (Offset.X, Scale.XY,
components X, Y, Z, W in any case): the animation then animates a
value of the sub-channel’s type (a scalar for one component, a
Vector2 for two, …) and leaves the other components alone. Several
sub-channels of one property run together; an animation of the whole
property replaces them.Source§fn start_animation_with_controller(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
controller: &Rc<AnimationController>,
)
fn start_animation_with_controller( &self, property_name: &str, animation: &dyn ICompositionAnimation, controller: &Rc<AnimationController>, )
StartAnimation(propertyName, animation, animationController): starts
the animation under controller, which can pause, resume, scrub and
speed it up. property_name may name a sub-channel, as for
start_animation.Source§fn try_get_animation_controller(
&self,
property_name: &str,
) -> Option<Rc<AnimationController>>
fn try_get_animation_controller( &self, property_name: &str, ) -> Option<Rc<AnimationController>>
TryGetAnimationController): the controller it was started with, or
a new controller that takes the running animation over. None when no
animation was started on the property through this object, or it was
stopped.Source§fn stop_animation(&self, property_name: &str)
fn stop_animation(&self, property_name: &str)
property_name may name a sub-channel
(Offset.X): the animations of the sub-channels that share a
component with it are stopped.Source§fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Source§fn start_animation_group_part(
&self,
animation: &dyn ICompositionAnimation,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_part( &self, animation: &dyn ICompositionAnimation, target: &str, final_value: ExpressionVariant, ) -> bool
StartAnimationGroupPart.Source§fn start_animation_group_for(
&self,
grp: &dyn ICompositionAnimationBase,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_for( &self, grp: &dyn ICompositionAnimationBase, target: &str, final_value: ExpressionVariant, ) -> bool
target to final_value. Returns whether one of the
animations targets that property.Source§fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Source§impl ICompositorSerializable for CompositionPropertySet
impl ICompositorSerializable for CompositionPropertySet
Source§fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>
fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>
c, if it
has one.Source§fn serialize_changes(&self, c: &Compositor, writer: &mut BatchStreamWriter<'_>)
fn serialize_changes(&self, c: &Compositor, writer: &mut BatchStreamWriter<'_>)
c.Source§fn serialization_key(&self) -> *const ()
fn serialization_key(&self) -> *const ()
Source§fn prepare_serialization(&self, _c: &Compositor)
fn prepare_serialization(&self, _c: &Compositor)
c. Read moreAuto Trait Implementations§
impl !Freeze for CompositionPropertySet
impl !RefUnwindSafe for CompositionPropertySet
impl !Send for CompositionPropertySet
impl !Sync for CompositionPropertySet
impl !UnwindSafe for CompositionPropertySet
impl Unpin for CompositionPropertySet
impl UnsafeUnpin for CompositionPropertySet
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more