https://github.com/emomaxd/twease
Twease is a header only C++ library designed to provide utilities for animation, tweening, and easing functions.
https://github.com/emomaxd/twease
animation c-plus-plus header-only tweening
Last synced: about 1 year ago
JSON representation
Twease is a header only C++ library designed to provide utilities for animation, tweening, and easing functions.
- Host: GitHub
- URL: https://github.com/emomaxd/twease
- Owner: emomaxd
- Created: 2024-07-10T13:12:01.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-13T18:52:56.000Z (almost 2 years ago)
- Last Synced: 2025-04-05T10:31:26.262Z (about 1 year ago)
- Topics: animation, c-plus-plus, header-only, tweening
- Language: C++
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Twease Library
===============
Overview
--------
Twease is a header only C++ library designed to provide utilities for animation, tweening, and easing functions. It facilitates smooth transitions between values and can be integrated into various applications requiring dynamic value changes over time.
To see easing functions as visually check [Twease-Visualizer](https://github.com/EmomaxD/TweaseVisualizer) out!
Features
--------
1. **Tweening**: Interpolate between sequences of values over a specified duration.
2. **Easing Functions**: Provide various easing functions (e.g., linear, quadratic, cubic) for smooth animations.
3. **Animation**: Transition smoothly between different states or values.
4. **Customizable**: Easily integrate into existing C++ projects with customizable interpolation methods and easing functions.
Animation example:
--------
```cpp
#include
#include
#include "Twease/Twease.h"
int main() {
double deltaTime = 0.016; // 60 FPS
auto anim = Twease::Animation::animate(0.0, 100.0).during(2.0).easing(Twease::cubicIn);
while (!anim.isCompleted()) {
anim.update(deltaTime);
std::cout << "Current value: " << anim.getCurrentValue() << std::endl;
}
return 0;
}
```
Tweening example:
--------
```cpp
#include
#include
#include "Twease/Twease.h"
int main() {
auto helloworld = Twease::Tween({ 'h', 'e', 'l', 'l', 'o' })
.to({ 'w', 'o', 'r', 'l', 'd' })
.during(50);
for (int i = 0; i <= helloworld.during(); ++i) {
std::vector interpolatedSequence = helloworld.step(static_cast(i) / helloworld.during());
for (char c : interpolatedSequence)
std::cout << c;
std::cout << std::endl;
}
return 0;
}
```