1
$\begingroup$

Newbie with animation nodes.

Through various tutorials, I've managed to come up with the following nodetree (blendfile: https://mega.nz/#!WHhXQKgK!jY9JOj2t-OHm_srS-ysibNsU7nSLnfmmBcRuPsBM9is )

Bargenerating nodetree

This tree generates bars in a barchart, from an original object (cube) that is hidden from both render and view. The height of the bars, and the number of bars, is determined by the contents of a blender text-blok with CSV-like data in it. First I split the textblock into lines (only the first line is used at this stage), and then I split that line by a custom defined seperator (in this case it's just a single spacechar)

enter image description here

I was hoping that I somehow could feed the resulting barobjects to another transformation-output and mix the values. The goal is to make it possible to eg. make the bars appear from left to right, perhaps make them "grow" from zero to their final size, perhaps even apply some snazzy f-curve or similar to put some bouncy/springy/whatever effect on the animations etc ...

I've been searchin' and searchin' - still I have absolutely zero clue on how to continue. If I simply add another transformation output, that output will totally overwrite the transformations set in the first transformation-output - no mixing whatsoever.

Can someone perhaps point me in the right direction?

$\endgroup$
2
$\begingroup$

basic result Click on the image to enlarge it.

I prefer to do the math on single values with Math nodes, which is why I have moved the Combine Vector to the back.

To get the time offset in the scaling animation, we start with the index of each cube from the Index output. With the Time Info node, we can get the current frame.

If we subtract the index from the frame we can get an offset for each element. If we multiply the index with an arbitrary factor before that, we'll get a bigger or smaller offset

frame   -   index  *  3   =  result
  9     -     0    *  3   =  9
  9     -     1    *  3   =  6
  9     -     2    *  3   =  3
  9     -     3    *  3   =  0
  9     -     4    *  3   =  -3

We can clamp the result from 0 to 1 and use it as the input to a MapRange node. The MapRange node also has the advantage of having an interpolation mode input. As you can see with the frame offset by the index, the first bars from left to right switch from 0 to 1 earlier.

This switch from 0 to 1 plays back the animation in the MapRange nodes output, so make sure to set the OuputMin to 0 and the OutputMax to our desired height of the value which you obtain from the ParseNumber node. (This part remains as in your original node graph.)

Because this switch from 0 to 1 only takes a single frame the animation of the bars change from one frame to another (and thus is not visible as an animation). Simply add another multiply node after our previous result, scaling the time downwards so that the 0-1 happens over multiple frames. I named this multiplier StrechAnimTime.


You may have noticed that this animation takes the same time for all bars making the longer bars move faster than the shorter bars. To make the animation time more proportional, use a multiplied version of the height (Parse Number result) for the InputMax of the MapRange node.

proportional time
Much more dramatic.

$\endgroup$
  • $\begingroup$ Great Leander! Thanks! I'll download your blend and see if I can wrap my head around your solution :D $\endgroup$ – Acebone Apr 1 '20 at 14:13
  • 1
    $\begingroup$ I tried to spell out the important parts in the answer. Just comment if anything is unclear. $\endgroup$ – Leander Apr 1 '20 at 14:17
  • $\begingroup$ Already - before trying to understand what you did, I have a problem: The bars are already there from the beginning - and new ones are animated on top of them? pasteboard.co/J1NOLug.png (you can see the colors - bars with two colors are in fact two bars, one stationary and one in the process of animation) - BTW - how did you make the nice gif? $\endgroup$ – Acebone Apr 1 '20 at 14:25
  • $\begingroup$ I had the same problem when I downloaded your file, it seems to be an animation nodes bug (maybe because we saved the file in different environments). Simply delete all the cubes in the "Animation Nodes" Collection. I use screentogif. $\endgroup$ – Leander Apr 1 '20 at 14:27
  • $\begingroup$ Got that working now - another q: Your file is 112 kb, mine is 785 kb - how'd you do that? $\endgroup$ – Acebone Apr 1 '20 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.