Skip to content

Instantly share code, notes, and snippets.

@UuuNyaa
Last active October 19, 2020 14:25
Show Gist options
  • Select an option

  • Save UuuNyaa/5d8f6de22c559a198f2fefc1e2ef943a to your computer and use it in GitHub Desktop.

Select an option

Save UuuNyaa/5d8f6de22c559a198f2fefc1e2ef943a to your computer and use it in GitHub Desktop.
import bpy
import random
random.seed(0)
(start,end,step)=(61,1401,2)
(x,y,z)=(0.294123,0.833412,0.436287)
(fx,fy,fz) = bpy.data.objects['FireLight'].animation_data.action.fcurves
def flickering(f, center):
keyframe_points = f.keyframe_points
for frame in range(start,end,step):
value = center+random.uniform(-0.02,+0.02)
keyframe_points.insert(frame=frame, value=value)
f.update()
flickering(fx,x)
flickering(fy,y)
flickering(fz,z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment