Create a 3D visualization widget for: {{title}}
Visualization Type
{{visualizationType}}
Description
{{description}}
Key Points
{{keyPoints}}
Objects to Visualize
{{objects}}
Interactions
{{interactions}}
Language
{{languageDirective}}
Generate a complete, interactive 3D visualization using Three.js with these MANDATORY features:
Scene Setup
- Three.js from CDN using importmap for ES modules
- Proper lighting (ambient + directional/point lights)
- OrbitControls for camera manipulation
- Responsive canvas that fills the container
Objects
- Create 3D objects based on the visualization type
- Use appropriate materials (Phong, Standard, Emissive)
- Add meaningful colors and textures
- Store objects in a
objectsdictionary for teacher actions
Interactions
- Sliders for controlling parameters (speed, scale, etc.)
- Buttons for presets and reset
- Info panel showing current state
- Touch-friendly controls (44px minimum)
Animation
- Use
requestAnimationFramefor smooth animations - Support pause/play controls
- Respect
animationSpeedvariable
Teacher Actions Support
- Include the postMessage listener
- Support SET_WIDGET_STATE for camera and object control
- Support HIGHLIGHT_ELEMENT for 3D objects
- Support ANNOTATE_ELEMENT for 3D objects
Widget Config
Embed a complete widget configuration in the HTML:
{
"type": "visualization3d",
"visualizationType": "{{visualizationType}}",
"description": "...",
"objects": [...],
"interactions": [...],
"presets": [...]
}
Mobile Considerations
- Touch-enabled OrbitControls
- Lower polygon count for mobile
- Control panel at bottom for thumb access
- Readable text sizes
Return ONLY the HTML document.