Skip to content

Use bezier-easing 3.2 closed-form solver in BezierEasing - #191

Open
gre wants to merge 1 commit into
openfl:masterfrom
gre:bezier-easing-3
Open

gre wants to merge 1 commit into
openfl:masterfrom
gre:bezier-easing-3

Conversation

@gre

@gre gre commented Oct 8, 2026

Copy link
Copy Markdown

Hi, this is @gre, I'm the author of bezier-easing, which is also embedded in this project (src/starling/animation/BezierEasing.hx). The library was recently improved with better performance and more reliability, and I wanted to backport the benefits here.

This brings its 3.2 solver (closed-form, no sample table) to BezierEasing.create:

  • Fixes steep curves. BezierEasing.create(1, 0, 0, 1)(0.4996) returned 0.348 instead of 0.431, so the tween went backwards for a frame.
  • Exact. Within 4e-15 of bezier-easing 3.2 on the reference values.
  • Lighter. No sample array per easing, and no Newton/bisection.
  • A ratio outside [0, 1] now saturates to 0 / 1. The old search returned arbitrary values there. The argument check and linear curves are unchanged.

I checked it with haxe --interp against the reference values and the old class.

download

Replace the sample table + Newton-Raphson + bisection search with the
closed-form solver of bezier-easing 3.2: exact, no backward jump on steep
curves such as (1, 0, 0, 1), and no sample array per easing.

A ratio outside [0, 1] now saturates to 0 / 1 instead of going through
the old search, which returned arbitrary values there.
@joshtynjala

Copy link
Copy Markdown
Member

Our code is ported from the original ActionScript 3.0 version of Starling Framework. Someone should probably do a similar PR on that project too (for folks using it with Adobe AIR, which is actually still maintained and updated, even though its sibling runtime Flash Player is discontinued):

https://github.com/Gamua/Starling-Framework/blob/master/starling/src/starling/animation/BezierEasing.as

@gre

gre commented Oct 8, 2026

Copy link
Copy Markdown
Author

thanks @joshtynjala thanks for letting me know about that other codebase. I will add it in my list of libs to backport this into. cheers

@gre

gre commented Oct 8, 2026

Copy link
Copy Markdown
Author

Gamua/Starling-Framework#1149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants