1
$\begingroup$

i would like to find a way to interpolate values that change each "random" frames. I can't use FCurve because i don't know the new values and they born from complex function f(obj.location) while the entire animation.

Example: i have value 5 from frame 1 to 30 then value 20 from frame 31 to 80 then value 9.5 from 81 to 102 and so on.

Here there is a file with the example than you can download but there is a problem. Each time the new value borns there is a flickering in the animation for two frames and then the interpolation is fine.

Anyone can tell me if this approach is the best or if is there a better method to solve my generic goal?

For info the flow of the example in the file is

  1. time starts
  2. when new value (in the file is a new random value) borns a set an attribute of an object
  3. in an second animation nodes layout i trigger the changed of the attribute and i "save" current frame and previous frame in other 2 attributes of the object
  4. the first animation nodes layout can, at this point, assign new value of map range (min and max) to interpolate. the trick is shift max value to the min and assign new max from new random value.
  5. at the same time i reset the value of map range with 0 (current frame - last current frame saved by triggering the random value change).
  6. as a result i have a loop of interpolation from min and max each time the new random value borns.

Thank you very much!

first animation nodes always execution

second animation nodes exec with trigger

$\endgroup$

1 Answer 1

0
$\begingroup$

This is not a "full" solution, but it works and i think the "logic" is a bit simpler than yours and easier to understand.

So first there is this "animate object"-subprogram, which takes the object, start vector and an end vector, start frame and a duration and it does what it's called: it animates the object from point a to b from "start frame" on in "duration" time.

I create 3 lists: a list of vectors which are the positions the object is moved from/to. A frame start list. A duration list.

The current values of the lists will be stored in the corresponding attributes.

They will be stored if the frame is equal to the frame list value.

And the subprogram will be called with exact these stored values.

What i didn't do but i think you know how do that:

You have to create 3 randomized lists (instead of my hardcoded ones) which should make sense (so duration should not overlap the next start frame e.g.).

Hope this helped you a bit.

If you have questions, just ask.

enter image description here

result:

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Hi Chris, thank you for your answer. I think it is a good solution for my problem, better then mine ;-) I'll try it! $\endgroup$ Sep 26, 2021 at 11:14
  • $\begingroup$ Glad I could help $\endgroup$
    – Chris
    Sep 26, 2021 at 11:42
  • $\begingroup$ I was very happy that your explanation in your question was so good that I could write it „on my own“ because to be honest I did not completely understand what you did in your node tree🙈 $\endgroup$
    – Chris
    Sep 26, 2021 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .