Replies: 11 comments 25 replies
-
|
Related? |
Beta Was this translation helpful? Give feedback.
-
|
Great, thanks for the feedback. I'm certainly open to changes and being careful about how we approach things. Here is my revised implementation (incorporating the feedback, thanks for that). Proposed ImplementationThis plan is designed to be minimally invasive. A. New File:
|
Beta Was this translation helpful? Give feedback.
-
|
Just checking in — since the full code is already in the discussion above and incorporates the feedback, do you want me to submit a formal PR as well, or are we happy to proceed from here? Happy to create the PR if that’s the preferred next step. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Animation lib update(https://github.com/Trilec/upp_AnimationEasing) Hey all — just a quick update after a few weeks on this. The little easing header I dropped earlier has grown into a proper animation lib. What’s working now What’s different from the old helpers Next steps Integration idea (small + safe):
This keeps it host-look-first, opt-in, and widget code stays untouched. A couple of tasteful demos (button hover fade, focus ring pulse, tab highlight slide) would prove the path. Would love feedback on whether this direction feels right before I wire it into CtrlLib. —Cheers |
Beta Was this translation helpful? Give feedback.
-
|
Hi, the line below will leak. This, IMO, is very dangerous anyway. IF you really need to use heap for this type of global stuff, you can use INITBLOCK and EXITBLOCK macros, where you can allocate and deallocate it from the heap. Even in that case I would recommend using If it is meant to be a global singleton, let's make it a singleton in more U++ style: :): This will prevent the leak. |
Beta Was this translation helpful? Give feedback.
-
|
A quick fix for leaking easing functions: This will hopefully solve the leak. However, this doesn't solve the potential dangling pointer issue if it is called later. So instead of returning a reference, you can return a pointer. ps: Note that this can be implemented more elegantly using a Vector or Array. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I just did some quick testing and seems quite interesting and easy to use.
Question : What does Animation::Progress() return ? : it seems to be the time progress and not the progress of the animation status. For my testing I wanted to try to apply it to some usual Ctrl => so I did this small template class and applied it to buttons. template <class BUTT>
class ShineAnimate : public BUTT {
private:
One<Animation> anim;
double easeP;
void PlayAnim() {
if ( !anim.IsEmpty() ) {
anim->Cancel(false);
}
anim.Create(*this);
anim->Duration(500);
anim->Ease(Easing::OutQuart());
(*anim)([&](double e) {
easeP = e;
this->Refresh();
return true;
});
anim->OnFinish( callback(this, &ShineAnimate<BUTT>::AnimEnd));
anim->Play();
}
public:
ShineAnimate() {}
void AnimEnd() {
PostCallback( [&] { anim.Clear(); BUTT::Refresh(); } );
}
virtual void LeftDown(Point pt, dword k) {
BUTT::LeftDown( pt, k );
PlayAnim();
}
virtual void Paint(Draw& w) {
BUTT::Paint(w);
if ( !anim.IsEmpty() ) {
double pr = easeP;
Rect r = BUTT::GetSize();
r.Deflate((1.0-pr)*r.Width()/2.0, (1.0-pr)*r.Height()/2.0);
w.DrawEllipse(r, LtGreen());
}
}
};
I could imagine a more complex class that furnishes several standard button animations |
Beta Was this translation helpful? Give feedback.
-
|
Hi , currently pushed to the Trilec upp_AnimationEasing |
Beta Was this translation helpful? Give feedback.
-
|
After further testing, I noticed that the configuration of the Animation instance is lost after Play(), so you have to reconfigure it before each play for ex: anim.Duration(180);
anim.Ease(Easing::OutQuart());
anim.Yoyo(true);
anim.Play(); |
Beta Was this translation helpful? Give feedback.
-
|
Got Some time to look at thinks: Just to clarify how some of the internals behave: I get why that might feel a bit odd at first, but the idea is to keep things safe and predictable — avoiding any stale config silently leaking across runs. To help with the case you mentioned (where you’d like to just run the same config again without re-typing setters), I’ve added a new Replay() method. That simply starts a fresh run using the last spec you played. |
Beta Was this translation helpful? Give feedback.
-
|
Hello Trilec, |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Below is the same proposal with the correct file paths and a couple of wording tweaks so nobody has to hunt for headers again.
Industrial Bézier Curve Engine for U++ Animation
U++ 2025.1 shipped the first
Animate()helper, but it only slides a widget’s rectangle with a fixed linear timer.This patch adds a tiny cubic-Bézier API plus a generic
AnimateProperty()template so any property—position, size, colour, opacity, angle—can move with ease-in, ease-out, or a designer-supplied curve. Four doubles describe the spline; classic helpers likeEaseInQuadare just wrappers. Everything is header-only,constexpr, and costs four multiplies per frame.Cubic-Bézier timing is standard in CSS, Qt, WPF, and Flutter, evaluated with the de Casteljau algorithm.
1 · Minimal source changes
Core/Util.htemplate<class T> constexpr T Lerp(const T&, const T&, double, Upp::Easing::Fn) noexcept→ returnsLerp(a,b,fn(t)).CtrlLib/CtrlUtil.h.Easing(Fn).• Add
template <class T> void AnimateProperty(...)(timer loop + newLerp).CtrlLib/Easing.h(new)using Fn.No
.cppfiles are needed; everything is inline.2 ·
Easing.h(drop-in)The curve must start (0,0) and end (1,1)—same rule as Qt
QEasingCurve::BezierSplineand WPFKeySpline.3 · Usage examples
Everything compiles after the three tiny edits above.
4 · Why this matters
(0,0,1,1).Fntypedef.Copy
Easing.h, add the two small patches, rebuild TheIDE, and your widgets will glide like any modern toolkit.Beta Was this translation helpful? Give feedback.
All reactions