I'm making a scoreboard, the look

and I want it to have a rotating animation that is activated once an integer value is edited. I have tried to rotate with tangent function, and it looks good, but I don't know how to make a limit function in blender so that there would be only one period for the animation to run. And so I have two questions:

  1. How to limit tangent math function?
  2. How to make the animation run with score (integer) being edited?

This is how I'm doing it right now, "Home" is the score input and it rotates the score text and cube it is attached to. Similarly, the cube is also rotating this way.


It most likely is just a math problem, but sadly in blender there isn't really a "lim" function in math node, so, yeah, any help is welcome.

EDIT: After a few comments I have to clear out some mistakes and explain properly what I'm asking about.

The first question: "How to limit tangent math function?" By this I meant to make Tangent wave go for only one period. The node group is making this kind of motion/function Function where the period (blue line) are repeating continuously, and the desired effect is to have only one period for motion.

Which then continues to the second question: "How to make the animation run with score (integer) being edited?" On repeat reading I can see why this question may be confusing. With previous question answered, I want to start the animation with changing the score (an integer value) so that whenever it goes up the animation based on Tangent function plays and score switches. For score going down, it is preferable for the animation to reverse, but it is not necessary for now.

I added a new blend file, with some clean-up and a slightly changed node setup for animation where, but it is similar to the previous nodetree image, but for clarity here's another image:New nodes New blend file:

  • $\begingroup$ (1) I am not sure I understand what you mean by "limiting the tangent function", but you could combine a compare node to detect if the "value" (whatever it is) is below the "limit". Then using a switch node, select the "value" if it is below the "limit" ; select the "limit" otherwise. But as this is what the Map Range node is doing, I imagine it is not what you are looking for... $\endgroup$ Commented Jan 31 at 22:11
  • $\begingroup$ (2) Do you want some event (e.g. a new value for "Home") to start again the rotation ? If so, could a "Simulation Zone" be a solution ? $\endgroup$ Commented Jan 31 at 22:15
  • 1
    $\begingroup$ en.wikipedia.org/wiki/XY_problem $\endgroup$ Commented Feb 1 at 12:09
  • 1
    $\begingroup$ @MarkusvonBroady: thank you for the wikipedia link. I completely missed the reference in your other post ! $\endgroup$ Commented Feb 1 at 17:35
  • 2
    $\begingroup$ As there are two parts in your question, and that part 1 is solved, may I recommend to post a new question with only the second part ? From my point of view, it is a better practice to get "atomic/focus" answers when both parts are not correlated, as I understand it in this case. $\endgroup$ Commented Feb 2 at 8:20

2 Answers 2


Based on the exchange in the comments, my comment:

You show a math graph with the problem of the tangent values repeating. But you didn't draw on top of it what you want to see instead. It looks like the typical perpendicular lines problem. Mathematically speaking, limiting inputs is just not using those inputs. Limiting outputs - as opposed to what you already get, maybe you want to just check if input is less than $-π \over 2$ and in such case return $-∞$, and if the input is over $+π \over 2$, return $+∞$?

To which the OP responded:

Yes, I want to have limited output of tangent

Mathematically speaking, you would just need to clamp the input value to the mentioned $[{-π \over 2},{+π \over 2}]$ range, with the "$[$" and "$]$" symbols meaning "including" - but technically the inputs are float32 numbers that can't express those boundary numbers with perfect precision...

One possible workaround is to find out what is the practical minimum and maximum number in this range that can be expressed by float32 number:

>>> import numpy as np
>>> start = np.float32(-pi/2)
>>> start > -pi/2  # check if it was rounded towards zero

>>> start = np.nextafter(start, np.float32(0))  # fix the above problem
>>> start > -pi/2  # check if it was rounded towards zero

>>> end = -start
>>> -pi / 2 < start < 0 < end < pi/2

>>> start, end
(-1.5707963, 1.5707963)

Now you can copy those numbers to clamp the input to them:

The above doesn't actually return negative and positive infinities, because it clamps values to a valid range. You may instead want to detect if a value is outside the valid range, and then return an infinity - in such a case the only real problem here is how to produce an infinity in geonodes. I suggest to just use a Math: Add node, and in the first field type as many nines as you can fit:

As you can see, while the field shows Inf, it's just because the field display precision is lower than float32 and so the value is rounded to infinity for display purposes, and the tooltips show an actual value stored in memory. So add to it another maximum number:

The custom group then becomes:

And the test:

  • $\begingroup$ Right now I'll say this is the answer to the question it answer the first part of the original question (hot to limit the function) but doesn't answer the second part (how to start the animation run with integer being edited). But still, thank you very much for this, even thou I got roasted for my communication skills a few times here. XDDD $\endgroup$
    – Demeterino
    Commented Feb 1 at 21:49

(Using Blender 3.6.5)

GN Simulation zone

1. The rotation is applied as long as $t-t_0 \leq T$, where $t$ is the current time, $t_0$ is the time the rotation was started, $T$ is the rotation duration.
2. If the Home input parameter is modified, $t_0$ is reset to the current time, to start a new rotation the next frame.


  • $\begingroup$ Well, this definitely is limiting the function so it would rotate only once, but it also easily breaks. Whenever there is a sporadic change to the score, about 45 degrees are added to the rotation or the score doesn't switch to another value at all. I will add an edit and a new blend file now, because there are indeed some mistakes and unclear information I have written into the question. $\endgroup$
    – Demeterino
    Commented Feb 1 at 15:12

You must log in to answer this question.

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