Since pointerId is already handled by the handle* methods we don't have to expose it in the onDrag* methods, this conforms with the standard set in Tappable.
This PR breaks the two classes apart: Component will now perform its own lifecycle management, and ComponentSet will focus on being a simple container.
This is a breaking change in terms that the user will need to update their dependency as well, but no code change will be required if they already moved their blocs to the new API.
An effect controller that represents a single period of the sine function. Use this to create
natural-looking harmonic oscillations. Two perpendicular move effects governed by
SineEffectControllers with different periods, will create a [Lissajous curve].
Added SequenceEffect, which performs a series of other effects.
The biggest challenge in implementing this feature came from the need to run the sequence in reverse, due to the alternate flag. This required that every effect and every controller supported running "back in time", which is not as simple as it sounds.
The following breaking changes were introduced:
The Effect class no longer supports .reverse() method and .isReversed flag.
This flag was added only 2 weeks ago (
Effect controllers restructuring #1134), with the idea that it will be necessary for the SequenceEffect. However, as it turned out, this flag is not as helpful as I thought it would be. In fact, given the user's ability to change it any point, it makes the implementation very error-prone.
To be clear, the ability for each effect to run in reverse remains -- only now it can no longer be triggered by the user manually. Instead, SequenceEffect triggers that ability itself at the alternation point. If there is demand in the future to manually force any effect to run backwards, we could restore this flag, but this would require thorough testing to make it work correctly.
Infinite effects now return duration = double.infinity instead of null, which seems more appropriate.
This adds SpeedEffectController -- new kind of effect controller that can be used to create effects that proceed with a predefined speed. In addition, the factory constructor EffectController() now has 2 more parameters speed and reverseSpeed for easier creation of speed-based effects. The argument duration is now optional.
The base EffectController class now has onMount() callback, which is invoked when the effect controller is attached to an Effect.
Loadable mixin is currently used for 2 classes: Game and Component. Its purpose is to provide the caching layer for the future returned by the onLoad() method. Having empty methods onMount() / onRemove() in that mixin does not fit its overall purpose. (Plus, in general, the purpose of any mixin is to add some additional concrete functionality into an existing class).
In addition to the scope mismatch, these methods perform similar yet not quite the same function in Game and Component. Having these methods declared directly within Game and Component allows to document them more precisely, and help the user understand their functionality/purpose better.
Simple alternating effect controller. Over the course of one period, this controller will proceed
linearly from 0 to 1, then to -1, and then back to 0. Use this for oscillating effects where the
starting position should be the center of the oscillations, rather than the extreme (as provided
by the standard alternating EffectController).