Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
ParticleEasing.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"
8
9namespace esengine::particle {
10
11// The enum's single source is the ES_ENUM ParticleEasing beside the component
12// fields that serialize it (EHT generates the TS const + editor dropdown from
13// there); the sim keeps its historical local name.
15
16// Delegates to the shared easing library so the math lives in ONE place
17// (easing consolidation). Particle keeps its own 4-value
18// enum (its serialized data format); the formulas are byte-identical to the quad
19// easings, so this is behavior-preserving.
20inline f32 applyEasing(EasingType type, f32 t) {
21 switch (type) {
22 case EasingType::EaseIn: return animation::easeInQuad(t);
23 case EasingType::EaseOut: return animation::easeOutQuad(t);
24 case EasingType::EaseInOut: return animation::easeInOutQuad(t);
25 case EasingType::Linear:
26 default: return animation::easeLinear(t);
27 }
28}
29
30} // namespace esengine::particle
Core type definitions and utilities for ESEngine.
ecs::ParticleEasing EasingType
f32 applyEasing(EasingType type, f32 t)
float f32
32-bit floating point
Definition Types.hpp:59