3
$\begingroup$

I'm trying to make an animation for a scoreboard, where the animation plays whenever the score value (I'm using an integer) changes. So, whenever it changes, the animation based on Tangent function plays and score switches.

The desired result:

enter image description here

Animation has to be continuously moving forward or backwards like in the gif.

Blender is running timeline in real time, so no key-frames can be used, only with nodes. Thus I remembered that I have asked a question for repeating a timer: Geometry Nodes: How to begin countdown from any frame with a click? where the answer could be used as an on switch with boolean value, and it works. Whenever boolean value is False the animation plays, but a new problem showed up. When I restart the animation, it rotates back to it's previous position, and doesn't add to the previous score.

enter image description here

Here is the node setup for rotation with animation (for rotation itself here:Geometry Nodes: How limit function and activate the said function with an integer change or a click?):enter image description here

And here is the node setup for the animation to start based on answer in the beginning:enter image description here

The blend file:

$\endgroup$

1 Answer 1

4
$\begingroup$

The setup is very simple:

  • Get the value and pass it to a Smooth Change group which uses a simulation zone to remember the old value and gradually move towards the new one; since we want a separate wheel for each digit, I encode them as one point per digit, and use Radius to store the digit's value.
  • Import or dynamically create a Digit Wheel for the visual effect.
  • Map the $[0, 9]$ range of a single digit to a $[0, τ - {τ \over 10}]$ ($0...9$ range multiplied by ${360° \over 10} = 36°$) and set it as a rotation of the wheel.

Smooth Change custom group:

  • First I make a Mesh Line of 7 points. Unfortunately you can't have more points, because there are no integer math operations in geonodes, and above $2^{24} = 16777216$ float precision becomes worse than $1$ (it will misread the last digit).
  • I convert it to points so it's as lightweight as possible in a simulation (that's why I use radius instead of a new attribute) and set the radius of all points to $0$ to initialize the roller at all zeroes.
  • I maintain Velocity in the simulation to simulate inertia for realistic effect.
  • Number to Digits converts currently set integer to separate points each representing a digit, from the units digit to the most significant digit (first point is last digit) - that's why the Mesh Line's offset is negative. The actual value of a digit is stored as the radius. So the same format as in the output of the simulation zone.

  • Engine defines the algorithm of the transition between two values of a digit.

If you want the rotations to go the short way between $0$ and $9$, you need to implement it in the Engine. If you want more acceleration, increase left multiplier, if you want more friction, decrease the right multiplier, if you don't want to overshoot - you need to adjust friction based on the distance to target ("other angle").

For completeness, this is the Digit Wheel I made:

$\endgroup$
1
  • 1
    $\begingroup$ Yes, this actually works! I have made a new node tree based on your setup and put it into mine. For anyone who is going to use this too, a couple of points: refresh your node tree with this setup, otherwise a bug in a form of geometry duplication will occur, and use values 0.1 to have a similar animation to the first gif. And that's it, thank you so much! The fact that it generally is a simple node tree of like 30 nodes is great for my pretty much novice in geo-nodes brain! Thank you again, so so much! $\endgroup$
    – Demeterino
    Feb 2 at 22:12

You must log in to answer this question.

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