pub struct MotionCache { /* private fields */ }Expand description
跨帧状态与过渡动画插值池(MotionCache)。
维护活跃属性过渡动画(no_std 下最多 16 个,std 下按需扩容;每帧求解后自动回收
已从元素树中消失的槽位)以及虚拟滚动列表的滚动偏移量与惯性速度。
Implementations§
Source§impl MotionCache
impl MotionCache
Sourcepub fn has_active_animations(&self) -> bool
pub fn has_active_animations(&self) -> bool
是否存在正在进行的过渡动画或惯性滚动。
Sourcepub fn transition_count(&self) -> usize
pub fn transition_count(&self) -> usize
当前占用的过渡动画槽位数量(用于容量监控与测试)。
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
帧求解开始:清除所有槽位的访问标记(由布局求解器自动调用)。
Sourcepub fn finish_all(&mut self)
pub fn finish_all(&mut self)
立即结束所有单次过渡动画并停留在各自目标状态(用于“减少动态效果”无障碍设置或测试快进)。
Sourcepub fn current_state(&self, id: u32) -> Option<MotionState>
pub fn current_state(&self, id: u32) -> Option<MotionState>
只读查询指定 ID 当前插值中的视觉状态(不推进时间、不更新访问标记)。
Sourcepub fn resolve(
&mut self,
id: u32,
target: MotionState,
spec: Option<TransitionSpec>,
) -> MotionState
pub fn resolve( &mut self, id: u32, target: MotionState, spec: Option<TransitionSpec>, ) -> MotionState
解析并更新带 ID 节点的跨帧过渡属性(颜色、几何、不透明度、入场、延迟与循环)。
Sourcepub fn resolve_div(
&mut self,
id: u32,
target_bounds: Region,
target_bg: Color,
target_border: Color,
spec: Option<TransitionSpec>,
) -> (Region, Color, Color)
pub fn resolve_div( &mut self, id: u32, target_bounds: Region, target_bg: Color, target_border: Color, spec: Option<TransitionSpec>, ) -> (Region, Color, Color)
解析并更新带 ID 的 Div 节点的跨帧过渡属性(兼容旧接口,不含不透明度)。
Sourcepub fn resolve_text_color(
&mut self,
id: u32,
target_color: Color,
duration_ms: u16,
) -> Color
pub fn resolve_text_color( &mut self, id: u32, target_color: Color, duration_ms: u16, ) -> Color
解析并更新文本颜色跨帧平滑过渡。
Sourcepub fn resolve_text_color_with(
&mut self,
id: u32,
target_color: Color,
parent: TransitionSpec,
) -> Color
pub fn resolve_text_color_with( &mut self, id: u32, target_color: Color, parent: TransitionSpec, ) -> Color
按父容器过渡配置(时长、缓动、延迟)解析文本颜色跨帧过渡。
Sourcepub fn scroll_offset(&self, id: u32) -> i16
pub fn scroll_offset(&self, id: u32) -> i16
获取指定滚动容器 ID 的当前垂直滚动偏移量(像素)。
Sourcepub fn set_scroll_offset(&mut self, id: u32, offset_y: i16)
pub fn set_scroll_offset(&mut self, id: u32, offset_y: i16)
设置指定滚动容器 ID 的垂直滚动偏移量(像素)。
Sourcepub fn set_scroll_inertia(&mut self, id: u32, velocity_y: i16, max_scroll: i16)
pub fn set_scroll_inertia(&mut self, id: u32, velocity_y: i16, max_scroll: i16)
设置滚动容器的最大可滚动范围与惯性速度。
Trait Implementations§
Source§impl Debug for MotionCache
impl Debug for MotionCache
Auto Trait Implementations§
impl Forget for MotionCache
impl Freeze for MotionCache
impl Move for MotionCache
impl RefUnwindSafe for MotionCache
impl Send for MotionCache
impl Sync for MotionCache
impl Unpin for MotionCache
impl UnsafeUnpin for MotionCache
impl UnwindSafe for MotionCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。