pub struct AnimationsActive(/* private fields */);Expand description
Per-tick flag raised by animation drivers (hover / press tweens, opacity transitions, scroll inertia) while a value is still in motion.
Read by the window backend right after App::tick() to self-schedule a
follow-up frame (RedrawScheduler.pending = true) so an in-flight
animation keeps advancing without waiting for an unrelated OS event.
Without this, the first tween frame paints and then the loop parks -
the animation freezes mid-way until the next mouse move.
Any other driver that finishes a tick with work still in flight raises it the same way, for the same reason: a parked loop runs no system, so work that completes off the frame (a background decode, a reply a later tick has to deliver) needs the next tick scheduled or it lands nowhere.
Idle-quiescence contract: the flag is stored in an AtomicBool so
several parallel animation systems can raise it via &Res without
serialising. reset_animations_active clears it at the start of
every tick (TickStage::Input, which is chained before
TickStage::Systems where the drivers run), and each driver re-raises
it only while it still has work left (progress strictly short of its
target, non-zero velocity, an element still without the content it
named). A driver keys its claim on something in the world rather than on
its own bookkeeping, so the claim dies with that thing even when the work
behind it never finishes. The moment every driver settles, none raises
it, the flag stays false, and the scheduler parks - so there is no
permanent vsync spin.
Implementations§
Source§impl AnimationsActive
impl AnimationsActive
Sourcepub fn request(&self)
pub fn request(&self)
Raise the flag: at least one animation still has motion this tick.
Interior-mutable so animation systems can take a shared Res.
Sourcepub fn get(&self) -> bool
pub fn get(&self) -> bool
Read the current flag without clearing it. The window backend calls this after the tick to decide whether to re-arm the redraw.
Sourcepub fn clear(&self)
pub fn clear(&self)
Clear the flag. Called by reset_animations_active at tick start.
Trait Implementations§
Source§impl Component for AnimationsActive
impl Component for AnimationsActive
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for AnimationsActive
impl Debug for AnimationsActive
Source§impl Default for AnimationsActive
impl Default for AnimationsActive
Source§fn default() -> AnimationsActive
fn default() -> AnimationsActive
impl Resource for AnimationsActive
Auto Trait Implementations§
impl !Freeze for AnimationsActive
impl RefUnwindSafe for AnimationsActive
impl Send for AnimationsActive
impl Sync for AnimationsActive
impl Unpin for AnimationsActive
impl UnsafeUnpin for AnimationsActive
impl UnwindSafe for AnimationsActive
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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().