# Sine wave function as an input value?

It is possible to use the variable #frame in an input field to make the value increment with each frame. It behaves as a Driver.

Example:

We can also halve or double the rate using #frame/2 or #frame*2 respectively. So I got to wondering to what extent we can write expressions in input fields. How complex can we get?

Is it also possible to input a sine wave as an expression?

The purpose would be for quickly animating objects that move cyclically:

• That thing is hypnotic. I am getting sleepy, sleepy – batFINGER Oct 25 '15 at 13:38

Sure, why not. The # symbol in the input field tells blender that you are inserting scripted driver with no variables. Everything after # will be put into the driver's expression field.
You can get a list what functions are build-in by typing bpy.app.driver_namespace[' into the console and hitting CtrlSpace.
You can totally input #cos(frame*pi/20) to match the curve you provided in the question.
• You can add your own item to the driver namespace bpy.app.driver_namespace["foo"] = bar, foo is how you reference it in a driver expression. foo / 2 foo(frame) sin(foo) etc. The driver expression must have a return value of type float or int – batFINGER Oct 25 '15 at 13:37
• @Mentalist Another handy tip is passing the locals() dictionary via a driver expression eg foo(locals()) locals() is a key, value dictionary, eg if driver has one variable var with a value of 1.4 the locals dictionary will be {"var":1.4} – batFINGER Oct 26 '15 at 18:03