Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
44c8b1f
remove string-based `via` overloads for easing
mobius3 Aug 17, 2025
b19932b
remove enum-based `via` overloads for easing
mobius3 Aug 17, 2025
8bc7471
simplify `via` method templates and adjust type usage
mobius3 Aug 17, 2025
eea7c91
remove unnecessary `inline` specifiers from tween template methods
mobius3 Aug 17, 2025
abec634
use nested namespace syntax for `tweeny::detail`
mobius3 Aug 17, 2025
7497b7d
remove `enumerated` easing enum from easing class
mobius3 Aug 17, 2025
a86f181
update easing implementations, simplify logic and adopt modern C++ fe…
mobius3 Aug 17, 2025
e12994a
refactor: remove redundant `inline` specifiers, adopt `const` for par…
mobius3 Aug 17, 2025
6847623
use nested namespace syntax for `tweeny::detail` in int2type header
mobius3 Aug 17, 2025
6c1e8d8
simplify `easingresolve` implementation and adopt modern C++ syntax
mobius3 Aug 17, 2025
2108ddd
adopt modern C++ features in tween class templates
mobius3 Aug 17, 2025
569b632
adopt modern C++ features in tweenpoint templates
mobius3 Aug 17, 2025
90ab934
adopt modern C++ features in traits and header
mobius3 Aug 17, 2025
266b910
use modern CMake features and enforce C++17 standards
mobius3 Aug 17, 2025
262f27d
add testing infrastructure with Catch2
mobius3 Aug 17, 2025
4d681f3
refactor: rename `stacked` to `start`, add time-based seek overload
mobius3 Aug 18, 2025
ff002fd
The great refactoring
mobius3 Aug 19, 2025
1d1e9c5
enhance precision, modernize methods, and enforce strict warnings
mobius3 Aug 20, 2025
268d206
use lambda for `return_value` logic in `interpolate`
mobius3 Aug 20, 2025
1943eaf
add `seek` and `jump` methods to `tween`
mobius3 Aug 20, 2025
866d257
add multiple easing functions as individual headers
mobius3 Aug 20, 2025
71bbb11
make `step`, `jump` and `seek` independent of each other
mobius3 Aug 20, 2025
afdecd1
add an event system with step listener support
mobius3 Aug 20, 2025
ff9a955
add `seek` and `jump` event listener support
mobius3 Aug 20, 2025
fcffdc2
unsubscribe support for event listeners
mobius3 Aug 20, 2025
351945a
improve builder with compile-time safety, preventing `build()` withou…
mobius3 Aug 22, 2025
b964ef8
update tween constructor and reorder frame updates
mobius3 Aug 22, 2025
6ae5277
clean up redundant line and correct spacing in headers
mobius3 Dec 25, 2025
70572f1
add `peek` and `progress` methods to `tween`
mobius3 Dec 25, 2025
6623fc9
move easing files to detail namespace
mobius3 Dec 25, 2025
8fbb1b7
remove non-const `render` method from `tween`
mobius3 Dec 25, 2025
be68a7c
migrate easing definitions to tweeny/easing.h
mobius3 Dec 25, 2025
f9381b7
document tweeny.h
mobius3 Dec 25, 2025
f939558
add complete event listener and update callbacks
mobius3 Dec 25, 2025
77c5bf4
migrate tests into categorized directories
mobius3 Dec 25, 2025
c70a86c
update cmake target sources
mobius3 Dec 25, 2025
f0d373c
add keyframeEnter and keyframeLeave events
mobius3 Dec 26, 2025
721a8ee
reorganize project structure and bump version to 4.0.0
mobius3 Dec 26, 2025
3e16e81
update include paths to match new project structure
mobius3 Dec 26, 2025
04659bc
document tweeny::easing namespace and its purpose
mobius3 Dec 26, 2025
c633f4c
document backIn, backOut, and backInOut easing functions
mobius3 Dec 26, 2025
b467b20
document bounceIn, bounceOut, and bounceInOut easing functions
mobius3 Dec 26, 2025
39cd2b2
document circularIn, circularOut, and circularInOut easing functions
mobius3 Dec 26, 2025
262481e
document cubic, elastic, and default easing functions
mobius3 Dec 26, 2025
4ed364f
document elasticInOut, exponentialIn, and exponentialOut easings
mobius3 Dec 26, 2025
c4653b9
document exponentialInOut, linear, and quadratic easings
mobius3 Dec 26, 2025
d23a03d
document quarticIn, quarticOut, and quarticInOut easings
mobius3 Dec 26, 2025
d5f0a2e
document quinticIn, quinticOut, and quinticInOut easings
mobius3 Dec 26, 2025
ca272fb
document sinusoidalIn, sinusoidalOut, sinusoidalInOut, and stepped ea…
mobius3 Dec 26, 2025
6fa330a
establish mainpage, update input paths, and refine doxygen layout
mobius3 Dec 26, 2025
a46889d
update manual and examples to reflect builder pattern
mobius3 Dec 26, 2025
a4581b3
add links to visualize easing functions at easings.net
mobius3 Dec 26, 2025
bd3c2f4
clarify manual wording and improve formatting for consistency
mobius3 Dec 26, 2025
8130d54
update event documentation and clarify usage examples
mobius3 Dec 26, 2025
5a77b8e
add update event type, tests, and handlers
mobius3 Dec 26, 2025
ae05b9a
add v3-to-v4 migration guide and update documentation
mobius3 Dec 26, 2025
5a48eef
update link text for easing visualizations in mainpage doc
mobius3 Dec 26, 2025
547eec2
remove sandbox example code and adjust CMake configuration
mobius3 Dec 26, 2025
24abd64
update copyright notice
mobius3 Jul 26, 2026
1e8f233
use quom directly from uvx
mobius3 Jul 26, 2026
75d95c3
dedupe license header from single-header target
mobius3 Jul 26, 2026
90beb1b
adjust dox return_values to be unique
mobius3 Jul 26, 2026
ddd9f25
update readme to 4.0.0 and backup old readme
mobius3 Jul 26, 2026
976a127
update docs and changelog
mobius3 Jul 26, 2026
3d387a4
Fix CMake install layout so find_package works again.
mobius3 Jul 28, 2026
d0d067c
add custom Doxygen styling and fonts for documentation
mobius3 Aug 2, 2026
380e498
update Doxygen styling to match tweeny-gh-pages theme
mobius3 Aug 2, 2026
268be9f
match Doxygen font styles with landing page
mobius3 Aug 3, 2026
84522ac
Merge branch 'master' into ng
mobius3 Aug 3, 2026
0f55d96
add easing function precomputed reference values for tests
mobius3 Aug 3, 2026
a5e871f
add linear easing unit test
mobius3 Aug 3, 2026
afb470a
handle edge cases in exponential easing functions
mobius3 Aug 3, 2026
9762b6a
add unit tests for cubic, quadratic, quartic, quintic, sinusoidal, an…
mobius3 Aug 3, 2026
ce64a55
add circular easing unit tests
mobius3 Aug 3, 2026
bee0219
add elastic easing unit tests
mobius3 Aug 3, 2026
cf7c9e1
add back and bounce easing unit tests
mobius3 Aug 3, 2026
594a1cd
remove swing easing reference values
mobius3 Aug 3, 2026
e73279a
remove sandbox target from build system
mobius3 Aug 3, 2026
7d82cf4
update documentation with new event system details
mobius3 Aug 3, 2026
d690a3d
expand README with update event example and details
mobius3 Aug 3, 2026
54d3cf4
update documentation with during(0U), progress, and update event
mobius3 Aug 3, 2026
689c0f8
document `event::update` for position changes
mobius3 Aug 3, 2026
8cb4b76
add tween-based unit tests for linear and quadratic easings
mobius3 Aug 3, 2026
c161025
rename parameters for clarity in tweeny_builder and from functions
mobius3 Aug 3, 2026
c278aac
add tween-based unit tests for quintic, sinusoidal, exponential, circ…
mobius3 Aug 3, 2026
231c436
add tween-based unit tests for back and bounce easings
mobius3 Aug 3, 2026
4447c70
add tween-based unit tests for def and stepped easings
mobius3 Aug 3, 2026
4c1c680
ensure seek, step, and jump behavior match peek across easings.
mobius3 Aug 3, 2026
73369cc
add CI workflow with tests on push and pull requests
mobius3 Aug 3, 2026
411bb58
update CMake install and expand README with usage details
mobius3 Aug 3, 2026
d072e77
add release script
mobius3 Aug 3, 2026
fbac898
update changelog for recent fixes, tests, and docs improvements
mobius3 Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build catch2

- name: Configure
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DTWEENY_BUILD_TESTS=ON

- name: Build
run: cmake --build build

- name: Test
run: ctest --test-dir build --output-on-failure
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# Tweeny Changelog
- Version 4.0.0
- **Breaking:** Requires C++17
- **Breaking:** `tweeny::from()` returns a builder; call `.build()` to create a tween
- **Breaking:** Tweens are immutable after `build()` (keyframes, durations, and easings cannot be changed)
- **Breaking:** Durations must be `uint32_t` (`during(60U)`); `step()` accepts `int32_t` frame deltas only (no percentage mode)
- **Breaking:** `seek()` accepts `uint32_t` absolute frame positions only (no percentage mode)
- **Breaking:** Multi-value tweens return `std::tuple` instead of `std::array`
- **Breaking:** Callbacks use `on(event::…)` with `event::response` return values instead of `onStep()` / `onSeek()`
- **Breaking:** `forward()` / `backward()` removed; use negative `step()` values to move backward
- **Breaking:** Headers moved to `include/tweeny/`; include as `#include <tweeny/tweeny.h>`
- **Breaking:** Removed `easing::enumerated` and string-based `via("linear")` easing selection
- New event types: `complete`, `keyframeEnter`, `keyframeLeave`, `update`
- New methods: `peek()`, `peek(frame)`, `progress()`, `jump(keyframe)`
- Restructured internals under `tweeny::detail`; easing split into per-function headers
- Added Catch2 test suite and Doxygen manual with v3-to-v4 migration guide
- CMake: C++17 enforcement, `FILE_SET HEADERS`, optional tests and single-header target (via `uvx` + quom)
- Fixed exponential easing endpoints (`position == 0` / `== 1`) to match Penner behavior
- Expanded tests: Penner reference samples for bundled easings (direct + `via`); `def`/`stepped` (including multi-keyframe stepped); seek/step/jump vs `peek` consistency
- GitHub Actions CI (Ubuntu, Catch2, build + ctest)
- `scripts/create-release.sh` — release from an existing tag (docs sync to `gh-pages`, single-header asset, GitHub Release)
- README: CMake install + `find_package(Tweeny)`; fixed installed include interface so `#include <tweeny/tweeny.h>` works after install
- Docs: `event::update`, `progress()`, honest zero-`during()` behavior; Doxygen styling aligned with the site
- Removed sandbox CMake option/target

- Version 3.2.1
- Adds `<string>` as dependency

Expand Down
104 changes: 57 additions & 47 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,73 +25,83 @@
# target that uses tweeny, a simple `target_link_libraries(target tweeny)` is sufficient to set up include and link
# instructions.

cmake_minimum_required(VERSION 3.0...3.28)
cmake_minimum_required(VERSION 3.23...3.28)
cmake_policy(SET CMP0063 NEW)
project(Tweeny LANGUAGES CXX VERSION 3.2.1)
project(Tweeny LANGUAGES CXX VERSION 4.0.0)

# Enforce C++17 for targets built in this project
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Setup variables and options
option(TWEENY_BUILD_DOCUMENTATION "Attempts to build the documentation. You'll need doxygen and graphviz installed" OFF)
option(TWEENY_BUILD_SINGLE_HEADER "Joins together all header files in a single one. Needs Python 3.6 and quom installed" OFF)
option(TWEENY_BUILD_SANDBOX "Adds a 'sandbox' target that links to tweeny. Useful when exploring tweeny" OFF)
option(TWEENY_BUILD_SINGLE_HEADER "Joins together all header files in a single one. Needs uv (https://docs.astral.sh/uv/) to run quom via uvx" OFF)
option(TWEENY_BUILD_TESTS "Build Tweeny tests (requires Catch2 v3 to be findable via CMake)" OFF)

# The library target
add_library(tweeny INTERFACE)

# Specify the C++ features a compiler should have to use this library.
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
target_compile_features(tweeny
INTERFACE
cxx_auto_type
cxx_variadic_templates
cxx_lambdas
cxx_nullptr
cxx_right_angle_brackets
cxx_static_assert
cxx_template_template_parameters
)
else()
list(APPEND CMAKE_CXX_FLAGS -std=c++11)
endif()
# Require C++17 for consumers of this interface library.
target_compile_features(tweeny INTERFACE cxx_std_17)

# Provide namespaced alias for consumers.
add_library(tweeny::tweeny ALIAS tweeny)

# Set up include directories
target_include_directories(tweeny INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/tweeny>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

# Attach headers to the interface target for IDEs and installation
target_sources(tweeny INTERFACE
FILE_SET HEADERS
BASE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
FILES
include/tweeny/event.h
include/tweeny/tweeny.h
include/tweeny/tween.h
include/tweeny/tween.tcc
include/tweeny/easing.h
include/tweeny/detail/event.h
include/tweeny/detail/interpolate.h
include/tweeny/detail/key-frame.h
include/tweeny/detail/tuple-utilities.h
include/tweeny/detail/tween-value.h
include/tweeny/detail/value-container.h
include/tweeny/detail/easing/back.h
include/tweeny/detail/easing/bounce.h
include/tweeny/detail/easing/circular.h
include/tweeny/detail/easing/cubic.h
include/tweeny/detail/easing/def.h
include/tweeny/detail/easing/elastic.h
include/tweeny/detail/easing/exponential.h
include/tweeny/detail/easing/linear.h
include/tweeny/detail/easing/quadratic.h
include/tweeny/detail/easing/quartic.h
include/tweeny/detail/easing/quintic.h
include/tweeny/detail/easing/sinusoidal.h
include/tweeny/detail/easing/stepped.h
)

# Set up install
include(GNUInstallDirs)
install(TARGETS tweeny EXPORT TweenyTargets)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tweeny)
install(TARGETS tweeny EXPORT TweenyTargets FILE_SET HEADERS)

# Set up export and config
include(cmake/SetupExports.cmake)

if (TWEENY_BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif()
add_subdirectory(src/doc)
endif ()

# This library is a convenience library to force files appear in the IDE properly.
add_library(tweeny-dummy
include/tweeny.h
include/tweeny.tcc
include/tween.h
include/tween.tcc
include/tweenone.tcc
include/tweenpoint.h
include/tweenpoint.tcc
include/tweentraits.h
include/easing.h
include/easingresolve.h
include/int2type.h
include/dispatcher.h)
set_target_properties(tweeny-dummy PROPERTIES LINKER_LANGUAGE CXX EXCLUDE_FROM_ALL TRUE)
if (TWEENY_BUILD_TESTS)
enable_testing()
add_subdirectory(src/tests)
endif ()

if (TWEENY_BUILD_SINGLE_HEADER)
include(cmake/GenerateSingleHeader.cmake)
endif()

if (TWEENY_BUILD_SANDBOX)
add_executable(sandbox src/sandbox.cc)
target_link_libraries(sandbox tweeny)
endif()
include(cmake/GenerateSingleHeader.cmake)
endif ()
86 changes: 86 additions & 0 deletions README-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
> **Note:** This is the README for Tweeny 3.x, kept for reference. For Tweeny 4.x, see [README.md](README.md).

# Tweeny
<a href="https://repology.org/project/tweeny/versions">
<img src="https://repology.org/badge/vertical-allrepos/tweeny.svg" alt="Packaging status" align="right" style="padding-left: 20px">
</a>

Tweeny is an inbetweening library designed for the creation of complex animations for games and other beautiful interactive software. It leverages features of modern C++ to empower developers with an intuitive API for declaring tweenings of any type of value, as long as they support arithmetic operations.

The goal of Tweeny is to provide means to create fluid interpolations when animating position, scale, rotation, frames or other values of screen objects, by setting their values as the tween starting point and then, after each tween step, plugging back the result.

**It features**:

- A descriptive and (hopefully) intuitive API,
- 30+ easing functions,
- Allows custom easing functions,
- Multi-point tweening,
- Simultaneous tween of heterogeneous value sets,
- Timeline-like usage (allows seeking to any point),
- Header-only
- Zero external dependencies
- Steps forwards or backwards :)
- Accepts lambdas, functors and functions as step and seek callbacks

**Obligatory hello world example**:

Linearly interpolate character by character from the word *hello* to *world* in `50` steps:

```cpp
auto helloworld = tweeny::from('h','e','l','l','o').to('w','o','r','l','d').during(50);
for (int i = 0; i < 50; i++) {
for (char c : helloworld.step(1)) { printf("%c", c); }
printf("\n");
}
```

Relevant code:

- **1**: create the tween instance starting with characters of the `hello` word, adds a tween target with the chars of the `world` word and specify it should reach it in `50` steps.
- **3**: move the tween forward by one step. Use the return value of it (which ill be a `std::array<char, 5>` in this case) to set up a for loop iterating in each char, printing it.

## Installation methods:

**Using your package manager**

There are some packages for tweeny made by some great people. Repology has a list of them and their versions [here](https://repology.org/metapackage/tweeny/versions). Thanks, great people!

**Not installing it**

You just need to adjust your include path to point to the `include/` folder after you've cloned this repository.

**Copying the `include` folder:**

Tweeny itself is a header only library. You can copy the `include/` folder into your project folder and then include from it: `#include "tweeny/tweeny.h"`

**Copying the `tweeny-<version>.h` header**

Since version 3.1.1 tweeny releases include a single-header file with all the necessary code glued together. Simply drop it on your project and/or adjust the include path and then `#include "tweeny-3.1.1.h"`.

**CMake subproject**

This is useful if you are using CMake already. Copy the whole tweeny project and include it in a top-level `CMakeLists.txt` file and then use `target_link_libraries` to add it to your target:

```
add_subdirectory(tweeny)
target_link_libraries(yourtarget tweeny)
```
This will add the `include/` folder to your search path, and you can `#include "tweeny.h"`.

## Doxygen documentation

This library is documented using Doxygen. If you intend to generate docs, specify the flag `TWEENY_BUILD_DOCUMENTATION` when generating CMake build files (e.g: `cmake .. -DTWEENY_BUILD_DOCUMENTATION=1`). You will need doxygen installed.

## Contributing

Tweeny is open-source, meaning that it is open to modifications and contrubutions from the community (you are very much encouraged to do so!). However, we'd appreciate if you follow these guidelines:

- Don't use `PascalCase` nor `snake_case` in names
- Use `camelCase`, but try to avoid multi word names as hard as possible
- Document code using Doxygen
- Implementation details should go inside `tweeny::detail` namespace.
- Template implementations should go into a `.tcc` file

## Examples:

Demo code showcasing some of Tweeny features can be seen in the [tweeny-demo](https://github.com/mobius3/tweeny-demos) repository. This repository also has instructions on how to build them.
Loading
Loading