-
-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Velocity Signal Functionality #942
Comments
I think the best API would be a mix of both propositions: const signal = Vector2.createSignal(0);
const velocity = signal.derivate(); Here, a At the same time, it doesn't introduce any additional performance overhead, like the |
Hello I would like to take on this issue with my team |
Signal effects #945 should probably be implemented first, since that functionality would likely be very useful for this issue |
Description
I propose the addition of Velocity Signal functionality to Motion Canvas, providing users with a powerful tool for creating motion blur effects and enhancing dynamic animations. This feature is especially valuable for users aiming to achieve realistic or stylized motion effects, such as stretching on high velocities and shrinking when slowing down.
Proposed Solution
I suggest introducing a utility function named
derivateSignal
to simplify the process of obtaining the velocity of a signal. This function would take a signal as an argument and return a new signal representing the velocity.Example usage:
Composability Example
One of the strengths of this feature is its composability. Users can take the derivative of a velocity signal to obtain the acceleration of the original signal. Here's a simple example:
With this approach, users can easily explore and incorporate higher-order derivatives into their animations, providing a rich set of tools for crafting intricate and dynamic motion effects.
Why This Feature?
Simplified API: Introducing a utility function for velocity provides a clean and straightforward way to access node velocity.
Enhanced Readability: The updated usage makes it easier for users to understand and implement motion effects based on node velocity.
Current possible implementation
To acchieve velocity signals currently, @aarthificial provided the following classes.
VelocitySignalContext for numbers:
VelocityVectorSignalContext for Vector2:
With these you can opt in to the signals that track the delta only when you need them.
Adding the Delta to Number and Vector2 Signals
An additional consideration is to automatically provide all number based signals with their derivative signal, accessible through the
delta
property of the signal:Since
delta
is a signal, users can also invoke it to obtain the current value:While this approach streamlines the process and ensures users have access to the velocity signal without explicit opt-ins, it comes with a caveat. There might be a potential performance overhead even when the functionality is not actively utilized. Consequently, careful consideration should be given to the trade-off between convenience and potential performance impact when deciding on this option.
The text was updated successfully, but these errors were encountered: