Jump to content
Sign in to follow this  

How to keyframe @frame outputs

Recommended Posts

Hello community!

Is there a way to control the @Frame value with a slider? 
Let's say I am moving a box in x with:

@P.x += @Frame*chf("Speed"); 

I would like to control the Position of the box with an animated chf function to make the box slower and slower over time until it stops at a certain point. This progression would be nice to animate with a slider.
But with the code above I only reset the cube to position 0 if i animate "Speed" to 0.
Maybe there is something else than the @frame attrib to create some sort of time dependent counter? 
I also can't use solvers, need to stay in sop context. 

Would be awesome if somebody could give me a hint 


Cheers, Marco

Share this post

Link to post
Share on other sites

First thing that comes to mind is if you are able to set that start and endpoint you could use the lerp function to animate the cube and have it stop. You could even procedurally set up the cubes animation using a channel ramp and a fit01 function into a time range.
The main reason the thing above does not work (and apologies if I am overexplaining here) is that while it might look like the box is taking one small step forward each frame, progressively making its way forward, it is actually going back to world 0 at every frame and then gets moved in the x axis alittle further than the last frame. So when you multiply the frame down it eventually just goes all the way back to world 0 without storing its "progress" because in reality there never was any "progress". By default Sops only care about the current frame, it is not designed to deal with progressive updates, that is what solvers are for.

However, if you could be persuaded to give the sop solver a try then something pretty similar to what you've got should be usable. Something like this:
v@P.x = point(1, 'P', @ptnum) + chf('Step_Size'); //Add this to a wrangle where the first input is "Input 1" inside the sop solver and the second input is the "Prev Frame" node inside the solver.

Hopefully, some of that can be useful.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this