Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
TweenSystem.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
3#pragma once
4
5#include "../core/Types.hpp"
6#include "../ecs/Registry.hpp"
7#include "TweenData.hpp"
8
9#include <vector>
10
11namespace esengine::animation {
12
14public:
15 void update(ecs::Registry& registry, f32 deltaTime);
16
17 Entity createTween(ecs::Registry& registry, Entity targetEntity,
18 TweenTarget property, f32 from, f32 to,
19 f32 duration, EasingType easing = EasingType::Linear);
20
21 void cancelTween(ecs::Registry& registry, Entity tweenEntity);
22 void cancelAllTweens(ecs::Registry& registry, Entity targetEntity);
23 void pauseTween(ecs::Registry& registry, Entity tweenEntity);
24 void resumeTween(ecs::Registry& registry, Entity tweenEntity);
25
26private:
27 void applyValue(ecs::Registry& registry, const TweenData& tween, f32 value);
28 f32 evaluateEasing(const TweenData& tween, f32 t);
29
30 std::vector<Entity> pending_remove_;
31 // UINode entities whose anim_override_ flags were set this frame; cleared at
32 // the start of the next update so layout regains the field once a tween ends.
33 std::vector<Entity> ui_flagged_;
34};
35
36} // namespace esengine::animation
Central ECS registry for entity and component management.
Core type definitions and utilities for ESEngine.
void resumeTween(ecs::Registry &registry, Entity tweenEntity)
void pauseTween(ecs::Registry &registry, Entity tweenEntity)
Entity createTween(ecs::Registry &registry, Entity targetEntity, TweenTarget property, f32 from, f32 to, f32 duration, EasingType easing=EasingType::Linear)
void cancelTween(ecs::Registry &registry, Entity tweenEntity)
void update(ecs::Registry &registry, f32 deltaTime)
void cancelAllTweens(ecs::Registry &registry, Entity targetEntity)
Central container for all entities and components.
Definition Registry.hpp:73
float f32
32-bit floating point
Definition Types.hpp:59
Entity identifier with packed index + generation.
Definition Types.hpp:135