2
$\begingroup$

I am trying to animate a shape key oscillating between -1 and 1 by driving it with the expression "sin(frame)".

I would expect that to result in the shape key value being "0" at frame 0 and 180, a value of "1" at frame 90, and a value of "-1" at frame 270.

Instead, I am getting a very rapid oscillation which never becomes negative, and has bizarre values that I wouldn't expect. The sin of 1° is 0.017, so I would think the sin of 1 frame is 0.017, but instead it is resulting in 0.841.

Here's a screenshot of this simple setup at frame 0: At frame 0, the result of the expression "sin(frame)" drives the Shape key to be a value of "0"

And at frame 1: At frame 1, Shape key is driven to a value of "0.841" instead of "0.017" like I would expect.

Thank you for your help! -Ben

$\endgroup$
  • 1
    $\begingroup$ Use this expression: sin(radians(frame)) The sin function expects angles in radians apparently $\endgroup$ – TLousky Dec 30 '15 at 16:03
  • $\begingroup$ that seems to be it, however it seems shape keys can't be negative. Do you want to post that as the answer so I can accept it? $\endgroup$ – Ben Mora Dec 30 '15 at 16:15
  • $\begingroup$ Just did, cheers. You're right about shapekey min and max values. $\endgroup$ – TLousky Dec 30 '15 at 16:28
5
$\begingroup$

The sin function expects angles in radians, rather than in degrees, which is why the correct driver expression will be:

sin(radians(frame))

Here's an example of this expression driving the Z value of a cube (you can see that it does indeed get negative values as well, and oscillates between -1 to 1): enter image description here

Though as you pointed out, shapekeys have a min value of 0 and a max value of 1.

$\endgroup$

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.