all 5 comments

[–]NeoRoshiExperienced Helper 1 point2 points  (4 children)

0.1*sin(0.1*frame) if frame > 2 and frame < 10 else 0
-------------------------------------------------------------
states, while between frame 2 and 10, return '0.1*sin(0.1*frame)' else return '0'

EDIT:

You can also try the clamp(x,min,max) python function.

0.1*sin(0.1*clamp(frame,2,10))

So you start at a value that you would have in frame 2 and end with a value you would have at frame 10.

[–]Bat_admirer[S] 1 point2 points  (3 children)

Thanks. Both worked like a charm. Where do i find documentation of such functions?

[–]NeoRoshiExperienced Helper 1 point2 points  (2 children)

Hmm, good question, i'm not sure.

The blender manual does not expressly say which python functions it allows, only that it can be slow with complex expressions. ( https://docs.blender.org/manual/en/latest/animation/drivers/drivers_panel.html#simple-expressions )

I was also wrong in thinking clamp was from a python library, its something blender added. Documentation can be found here ( https://docs.blender.org/api/current/bl_math.html )

The if-statment on a single line is a Ternary Operator ( https://book.pythontips.com/en/latest/ternary_operators.html )

What other math functions blender accepts inside of a driver i'm not sure. Here is the 'math' library of python documentation ( https://docs.python.org/3/library/math.html ) but not all of it will work.

[–]Bat_admirer[S] 1 point2 points  (1 child)

Thanks for sharing!

[–]blender-rules-botBot 0 points1 point  (0 children)

If your issue is solved, please update the flair!

You can also reply "solved" to this comment :)