`Friz` animation controller 2.0.0 released

I’ve just released an update to the friz animation control library. The most significant change is that it now supports the recently added juce::VBlankAttachment class so that effects can be synchronized with the display. Thanks to the JUCE team for adding that – slotted in much more easily than I expected.

Main Repo: GitHub - bgporter/animator: Flexible animation controller for JUCE applications.
Demo App: GitHub - bgporter/frizDemo: Demo app for the `friz` animation controller for JUCE.
API Docs: friz: Main Page


2.0.0 February 5, 2023

Breaking Changes

This is a major version bump, and as such, there are breaking changes that will require updates in existing code:

  • All functions/method names have been converted from StudlyCaps to mixedCase to follow JUCE conventions.
  • All durations are now specified in milliseconds instead of frames. It should always have been this way, but without doing this, synching to vertical blanking would have been problematic.
  • new argument added to the completion callback; a boolean wasCanceled will be passed to indicate whether the animation is ending normally, or because it was cancelled.
  • New DisplaySyncController class uses the juce::VBlankAttachment class to synchronize animation updates with the display.
  • The Easing family of AnimatedValue (EaseIn, EaseOut, Spring) objects will need much attention with regards to their control values (slew, acceleration, etc.) To support variable frame rates sensibly, all of these curves are now updated internally at a rate of 1000 frames per second, so they should have the same behavior regardless of the actual frame update rate that’s in use.

Non-breaking Changes

  • Doxygen comments corrected, cleaned up, added as needed
  • General cleanup throughout
  • MIT license text added at top of all source files.
12 Likes

Hi, wanted to read up on what this does. At your Git, this link no longer works:

For a fuller discussion of these classes, see my blog post at https://artandlogic.com/2019/09/friz-and-the-illusion-of-life/.

1 Like

Ah, thanks for this – they changed the URL to friz and the Illusion of Life - Art+Logic; I’ll update in the README.

1 Like

Would be cool to get a bit more of a detailed description of Friz up front … I had to drill in a bit to see what it was and what I would use it for …

Updated to 2.0, was very easy. Thanks Brett, definitely buttery smoooth.

Is there a reason why the friz::Animator constructor doesn’t take an FPS value anymore? I had that set to 60 before, was thinking it might still be smart to cap to 60fps for performance reasons.

I mentioned on twitter, but one feature I’d love to see is a convenience method to make things a bit less verbose when animating a single parameter:

For example, I currently have a fade out like this:

auto fade = std::make_unique<friz::Parametric> (friz::Parametric::CurveType::kEaseOutQuintic, 1.0f, 0, 1000);
auto tween = std::make_unique<friz::Animation<1>> (friz::Animation<1>::SourceList { std::move (fade) }, 0);

tween->onUpdate ([&] (int id, const auto& val) {
    owner.setAlpha(val[0]);
});

tween->onCompletion ([&] (int /* int id */, bool /* bool wasCancelled */) {
    owner.setVisible(false);
});

Would be sweet if we could do something like this instead of the first two lines:

auto tween = friz::Tween { friz::Parametric::CurveType::kEaseOutQuintic, 1.0f, 0, 1000 }
1 Like

Agreed that things are clunkier than I’d like in a few areas. Hoping to clear another weekend to dig into these things soon.

Glad that it went smoothly for you – I don’t expect to get around to this with the project at work where we use this for a while…

1 Like

Coming soon (need to modify some ctors and test test test), a much cleaner/simpler factory API, compare the two approaches:

#define NEW_STYLE 1
#if NEW_STYLE
            auto fade = friz::makeAnimation<friz::Linear>(box->getId(), currentSat, 0.f, dur);
#else
            auto fade = std::make_unique<friz::Animation<1>> (
                friz::Animation<1>::SourceList {
                    std::make_unique<friz::Linear> (currentSat, 0.f, dur) },
                box->getId ());
#endif
2 Likes

Just released 2.1, including:

  • the makeAnimation function mentioned above in the thread.
  • new Chain animation type that lets you execute unrelated animation types in series (as opposed to the exiting Sequence type that requires all of the sequential animations to have the same ValueCount)
  • Overhauled README including a new Crash Course section (thanks to @austrianaudioJV for pointing out that there wasn’t much useful introductory text), a nice clean example submitted by @sudara, and a correction of the blog post link that have been changed, as mentioned here by @stephenk.
9 Likes

Nice work!! Looking forward to trying out the new syntax.

1 Like

Updating from 2.0 to 2.1, do I now need to always explicitly pass a DisplaySyncController to the animator like in the README like so?

animator { std::make_unique<friz::DisplaySyncController> (this) }

If so, it could be nice if FRIZ_VBLANK_ENABLED=1 (> Juce 7.0.3) defaulted to that controller behind the scenes…

Great idea – we’d need to add a new ctor so that the component whose blank is used can get passed in to build the DisplaySyncController inside the ctor.

1 Like

Hey Brett,

Just wondering if you still plan to add that new ctor (or if you’d accept a PR for it). I think that would help make the API really nice and clean on JUCE >= 7.0.3.

Thanks! Just working on animation again here :slight_smile: