8#include <unordered_map>
36 void setFrom(
const std::string &
name,
float value);
38 void setTo(
const std::string &
name,
float value);
40 void setDelta(
const std::string &
name,
float delta);
43 void setFromAngle(
const std::string &
name,
float radians);
45 void setToAngle(
const std::string &
name,
float radians);
47 void setDeltaAngle(
const std::string &
name,
float deltaRadians);
50 bool has(
const std::string &
name)
const;
52 float get(
const std::string &
name)
const;
54 float getFrom(
const std::string &
name)
const;
56 float getTo(
const std::string &
name)
const;
58 float getDelta(
const std::string &
name)
const;
61 void setDuration(
float seconds);
65 void setDelay(
float seconds);
69 void setEase(
const std::string &
kind);
71 std::string
getEase()
const {
return ease_; }
77 void setRepeat(
int count);
97 bool isRunning()
const {
return state_ == State::Running; }
99 bool isPaused()
const {
return state_ == State::Paused; }
101 bool isFinished()
const {
return state_ == State::Finished; }
103 bool isStopped()
const {
return state_ == State::Idle || state_ == State::Stopped; }
105 bool isDelayed()
const {
return state_ == State::Delayed; }
108 return state_ == State::Delayed || state_ == State::Running || state_ == State::Paused;
114 float getProgress()
const;
116 float getEasedProgress()
const;
125 bool update(
float dt);
128 float evaluate(
const std::string &
name,
float t)
const;
133 std::string getPropertyName(
int index)
const;
138 enum class State { Idle, Delayed,
Running, Paused, Finished, Stopped };
140 enum class EndMode { Absolute, Delta };
147 bool hasFrom =
false;
148 EndMode endMode = EndMode::Absolute;
149 bool isAngle =
false;
150 bool resolved =
false;
153 void setOwner(Animation *owner) { owner_ = owner; }
154 Animation *owner()
const {
return owner_; }
155 Track &ensureTrack(
const std::string &
name);
156 const Track *findTrack(
const std::string &
name)
const;
157 void resolveTracks();
158 void applyProgress(
float linearT);
160 static float ease(
float t,
const std::string &
kind);
161 static float lerpAngle(
float a,
float b,
float t);
162 static float clamp01(
float t);
165 float duration_ = 1.f;
167 float delayLeft_ = 0.f;
168 float elapsed_ = 0.f;
172 bool reverse_ =
false;
173 std::string ease_ =
"linear";
174 State state_ = State::Idle;
175 std::unordered_map<std::string, Track> tracks_;
176 std::vector<std::string> order_;
178 bool hasLastTick_ =
false;
180 bool updateUnchecked(
float dt);
#define EVENGINE_API_WORLD
HexCoordinates to
Cell the unit walks towards on this segment.
Common time values and an injectable deterministic simulation clock.
Move-only operation result carrying either a value or Status.
Animation module — tween factory + 2D sprite-sheet / Spine + 3D skeletal playback (player / state mac...
Property tween — interpolates named float properties from → to over time.
bool isFinished() const
True when finished.
bool isRunning() const
True when running.
int getRepeat() const
Returns the repeat.
bool getYoyo() const
Returns the yoyo.
int getPropertyCount() const
Names of all property tracks (stable order = insertion order).
float getDuration() const
Returns the duration.
bool hasCurrentTick() const noexcept
Whether this tween has consumed a scheduler step.
bool isPaused() const
True when paused.
void setYoyo(bool enabled)
Sets the yoyo.
bool isDelayed() const
True when delayed.
bool isActive() const
True when active.
float getDelay() const
Returns the delay.
eve::SimulationTick currentTick() const noexcept
Last scheduler tick consumed by this tween.
std::string getEase() const
Returns the ease.
Tween(const Tween &)=delete
float getElapsed() const
Elapsed time in the current cycle (excludes delay).
bool isStopped() const
True when stopped.
Tween & operator=(const Tween &)=delete
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
State
Lifecycle state of a generic transaction plan.
One deterministic fixed-step emitted by SimulationClock.