write story on groundhogs and convert in python code to create story in blender
- User
write story on groundhogs and convert in python code to create story in blender
Assistant
Here's a whimsical groundhog story and a Python script to generate a simplified 3D version in Blender:
# Groundhog Day Adventure - Blender Python Script import bpy import math # Clear existing objects bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() # Create ground plane bpy.ops.mesh.primitive_plane_add(size=20) ground = bpy.context.object ground.data.materials.append(bpy.data.materials.new(name="Grass")) # Create groundhog burrow bpy.ops.mesh.primitive_cylinder_add(radius=0.5, depth=1, location=(0, 0, -0.5)) burrow = bpy.context.object burrow.data.materials.append(bpy.data.materials.new(name="Dirt")) # Create groundhog character def create_groundhog(location): # Body bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, location=location) body = bpy.context.object body.data.materials.append(bpy.data.materials.new(name="GroundhogFur")) # Head bpy.ops.mesh.primitive_uv_sphere_add(radius=0.3, location=(location[0], location[1]-0.5, location[2]+0.6)) head = bpy.context.object # Eyes for offset in [-0.15, 0.15]: bpy.ops.mesh.primitive_uv_sphere_add(radius=0.05, location=(location[0]+offset, location[1]-0.6, location[2]+0.8)) eye = bpy.context.object # Legs for front in [-1, 1]: for side in [-1, 1]: bpy.ops.mesh.primitive_cylinder_add(radius=0.1, depth=0.5, location=(location[0]+side*0.3, location[1]+front*0.3, location[2]-0.3)) return body, head # Create main character main_groundhog, main_head = create_groundhog((0, 2, 0)) # Create friend groundhog friend_groundhog, friend_head = create_groundhog((1.5, 3, 0)) friend_material = bpy.data.materials.new(name="FriendFur") friend_groundhog.data.materials.append(friend_material) # Animate groundhog emerging main_groundhog.location.z = -0.5 main_groundhog.keyframe_insert("location", frame=1) main_groundhog.location.z = 0.5 main_groundhog.keyframe_insert("location", frame=25) # Add camera bpy.ops.object.camera_add(location=(5, -5, 4)) camera = bpy.context.object camera.data.angle = math.radians(60) camera.constraints.new('TRACK_TO').target = main_groundhog # Add sun light bpy.ops.object.light_add(type='SUN', radius=0.1) light = bpy.context.object light.data.energy = 5 # Set animation length bpy.context.scene.frame_end = 50 print("Story elements created! Press Alt+A to play animation.")Story: "Paddy the Groundhog's Spring Adventure"
In a sun-dappled forest clearing, Paddy the groundhog wakes from his winter nap. He wriggles up through his earthen tunnel (frame 1-25), blinking at the spring sunshine. Sniffing the air, he spots a daisy field where his friend Wanda is already foraging. They meet beneath the old oak tree, nibbling clover and chasing butterflies. As dusk approaches, they retreat into Paddy's cozy burrow, ready to dream of summer days.
To use the script:
- Open Blender, go to Scripting workspace
- Create new text block and paste code
- Click "Run Script"
- Switch to Animation workspace to view timeline
- Press Alt+A to play the 50-frame animation
The script creates:
- A grassy meadow with dirt burrow
- Two distinct groundhogs with basic features
- Simple emergence animation
- Tracking camera and daylight setup
You can enhance it with:
- More detailed character models
- Flower fields using particle systems
- Complete walk cycle with leg movement
- Background trees and environment elements
- Facial expressions during interactions
- User
write story on groundhogs and convert in python code to create 2d animation story in blender
Assistant
Here's a 2D-style groundhog story and a Python script to create a simplified 2D animation in Blender using Grease Pencil-style flat objects:
# Groundhog Day Tale - 2D Blender Animation Script import bpy import math # Clear existing objects bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() # Set up orthographic camera for 2D look bpy.ops.object.camera_add(location=(0, -10, 0)) camera = bpy.context.object camera.data.type = 'ORTHO' camera.data.ortho_scale = 15 camera.rotation_euler = (math.radians(90), 0, 0) bpy.context.scene.camera = camera # Create ground plane bpy.ops.mesh.primitive_plane_add(size=20, location=(0, 0, 0)) ground = bpy.context.object ground.data.materials.append(bpy.data.materials.new(name="EarthBrown")) # Create burrow entrance (circle) bpy.ops.mesh.primitive_circle_add(radius=1.5, fill_type='NGON', location=(0, 0, 0.1)) burrow = bpy.context.object burrow.data.materials.append(bpy.data.materials.new(name="BurrowBlack")) # Create groundhog (flat design) def create_groundhog(location, name_suffix): # Body bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=location) body = bpy.context.object body.scale = (1, 0.5, 0.5) # Flatten into 2D circle body.data.materials.append(bpy.data.materials.new(name=f"Groundhog{name_suffix}")) # Eye bpy.ops.mesh.primitive_uv_sphere_add(radius=0.2, location=(location[0]+0.5, location[1], location[2]+0.5)) eye = bpy.context.object return body # Create main character main_groundhog = create_groundhog((0, 3, 1), "Main") # Create friend groundhog friend_groundhog = create_groundhog((3, 5, 1), "Friend") # Animate main groundhog emerging (frame 1-30) main_groundhog.location.y = -5 main_groundhog.keyframe_insert("location", frame=1) main_groundhog.location.y = 3 main_groundhog.keyframe_insert("location", frame=30) # Animate friend groundhog appearing (frame 20-50) friend_groundhog.location.y = -5 friend_groundhog.keyframe_insert("location", frame=20) friend_groundhog.location.y = 5 friend_groundhog.keyframe_insert("location", frame=50) # Add story text elements def add_text(text, location, frame_start, frame_end): bpy.ops.object.text_add(location=location) txt = bpy.context.object txt.data.body = text txt.data.size = 1.2 txt.data.materials.append(bpy.data.materials.new(name=f"Text{location[1]}")) # Fade in/out animation txt.data.materials[0].node_tree.nodes.new('ShaderNodeValue') txt.data.materials[0].node_tree.links.new( txt.data.materials[0].node_tree.nodes['Principled BSDF'].inputs['Alpha'], txt.data.materials[0].node_tree.nodes['Value'].outputs[0] ) # Keyframes for visibility txt.data.materials[0].node_tree.nodes['Value'].outputs[0].default_value = 0 txt.data.materials[0].node_tree.nodes['Value'].keyframe_insert("default_value", frame=frame_start-10) txt.data.materials[0].node_tree.nodes['Value'].outputs[0].default_value = 1 txt.data.materials[0].node_tree.nodes['Value'].keyframe_insert("default_value", frame=frame_start) txt.data.materials[0].node_tree.nodes['Value'].outputs[0].default_value = 0 txt.data.materials[0].node_tree.nodes['Value'].keyframe_insert("default_value", frame=frame_end) # Add story elements story_parts = [ ("Groundhog Day Tale", (0, 8, 2), 1, 60), ("Paddy wakes up from winter sleep...", (0, 6, 2), 30, 90), ("...and spots his friend Wanda!", (0, 4, 2), 60, 120), ("They celebrate the arrival of spring!", (0, 2, 2), 90, 150) ] for text, loc, start, end in story_parts: add_text(text, loc, start, end) # Set animation length bpy.context.scene.frame_end = 150 print("2D animation created! Press Alt+A to play the 150-frame story.")Story: "Paddy's Spring Celebration"
In a sunny meadow, Paddy the groundhog wakes from his winter slumber (frame 1-30). Emerging from his burrow, he stretches his legs and notices his friend Wanda waving from across the field (frame 20-50). The two old friends meet to celebrate the arrival of spring with a dance party beneath the blossoming trees, their joyful laughter echoing through the valley.
To use the script:
- Open Blender, switch to Scripting workspace
- Create new text block and paste the code
- Click "Run Script"
- Switch to Animation workspace to view timeline
- Press Alt+A to play the 150-frame 2D animation
Key 2D animation features:
- Orthographic camera for flat perspective
- Flattened spheres to create 2D character shapes
- Text-based storytelling with fade transitions
- Side-view scene layout
- Simple motion along Y-axis
Enhancement suggestions:
- Add 2D background using planes with textures
- Create more detailed character sprites
- Use shape keys for facial expressions
- Add particle effects for falling petals
- Include simple UI elements for chapter markers
This script creates a stylized 2D animation while working within Blender's 3D environment, using scaling and camera settings to achieve the 2D look.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.