Skip to content

Instantly share code, notes, and snippets.

@kit-agawa
Created October 2, 2025 13:09
Show Gist options
  • Select an option

  • Save kit-agawa/94a18f982d5b1c016a119d4cbe25882f to your computer and use it in GitHub Desktop.

Select an option

Save kit-agawa/94a18f982d5b1c016a119d4cbe25882f to your computer and use it in GitHub Desktop.
blender sprite rotation render
import bpy
import math
import os
# Settings
scene = bpy.context.scene
output_dir = scene.render.filepath
steps = 8
# Animation length
frame_count = scene.frame_end - scene.frame_start + 1
obj = bpy.context.active_object
if obj is None:
raise Exception("Please select your object before running the script.")
# Save the original rotation
original_rotation = obj.rotation_euler.copy()
for i in range(steps):
angle = (360 / steps) * i
# Apply rotation on Z axis
obj.rotation_euler[2] = math.radians(angle)
for frame in range(scene.frame_start, scene.frame_end + 1):
scene.frame_set(frame)
# Continuous frame numbering
frame_number = (i * frame_count) + (frame - scene.frame_start + 1)
filename = f"render_{frame_number:04d}.png"
scene.render.filepath = os.path.join(output_dir, filename)
# Render one frame at a time
bpy.ops.render.render(write_still=True)
# Restore original rotation
obj.rotation_euler = original_rotation
scene.render.filepath = output_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment