write detailed svg code for butterfly
- User
write detailed svg code for butterfly
Assistant
Okay, here is detailed SVG code for a butterfly. This example includes:
- Body and Head: Using a path and a circle.
- Antennae: Using paths.
- Wings: Two forewings and two hindwings, created using
pathelements for organic shapes. - Symmetry: Designing one side (left wings and antennae) and using
transformto mirror them for the other side. - Wing Patterns: Adding some simple spots and bands within the wings using
circleandpathelements. - Styling: Using CSS within
<style>tags for colors and stroke. - Grouping: Using
<g>elements to organize the different parts (body, antennae, wings). - ViewBox: Setting up a
viewBoxfor scalability.
<svg width="600" height="450" viewBox="0 0 600 450" xmlns="http://www.w3.org/2000/svg"> <title>Detailed Butterfly</title> <desc>An SVG illustration of a butterfly with body, antennae, wings, and patterns.</desc> <style> /* Define colors and styles */ .butterfly-body { fill: #5A3824; /* Dark brown */ stroke: none; } .butterfly-head { fill: #5A3824; /* Dark brown */ stroke: none; } .butterfly-antennae { fill: none; stroke: #5A3824; /* Dark brown */ stroke-width: 2; stroke-linecap: round; } .forewing { fill: #FFDA3D; /* Yellowish */ stroke: #000000; /* Black stroke */ stroke-width: 1.5; stroke-linejoin: round; } .hindwing { fill: #F4A460; /* Sandy brown */ stroke: #000000; /* Black stroke */ stroke-width: 1.5; stroke-linejoin: round; } .wing-pattern-spot { fill: #000000; /* Black */ stroke: none; } .wing-pattern-band { fill: #A0522D; /* Sienna */ stroke: none; } .wing-pattern-vein { fill: none; stroke: rgba(0, 0, 0, 0.3); /* Semi-transparent black */ stroke-width: 1; stroke-linecap: round; } </style> <!-- Group for the entire butterfly --> <!-- Centered horizontally at x=300 in the 600x450 viewBox --> <g class="butterfly-group" transform="translate(300, 225)"> <!-- Body and Head --> <g class="body-group"> <!-- Body (thorax and abdomen) - Path makes it more organic --> <path class="butterfly-body" d="M 0 -80 C 10 -70 10 -40 5 -30 L 5 50 C 5 70 -5 70 -5 50 L -5 -30 C -10 -40 -10 -70 0 -80 Z" /> <!-- Head --> <circle class="butterfly-head" cx="0" cy="-85" r="8" /> </g> <!-- Antennae --> <g class="antennae-group"> <!-- Left Antenna --> <path class="butterfly-antennae" d="M 0 -85 Q -15 -110 -30 -105" /> <!-- Right Antenna (mirrored) --> <path class="butterfly-antennae" d="M 0 -85 Q 15 -110 30 -105" /> </g> <!-- Wings --> <!-- Note: The wing paths are defined relative to their connection point near the body. The entire wing group is then positioned relative to the butterfly center (0,0). --> <g class="left-wings"> <!-- Left Forewing --> <path class="forewing" d="M -5 -35 C -60 -100 -180 -80 -150 50 C -130 90 -40 60 -5 -35 Z"> <!-- Forewing Patterns --> <circle class="wing-pattern-spot" cx="-90" cy="-30" r="15" /> <circle class="wing-pattern-spot" cx="-60" cy="10" r="8" /> <path class="wing-pattern-band" d="M -40 -10 C -80 20 -120 30 -100 50 C -90 40 -60 10 -40 -10 Z" /> <!-- Veins (example) --> <path class="wing-pattern-vein" d="M -5 -35 Q -50 -60 -90 -50"/> <path class="wing-pattern-vein" d="M -5 -35 Q -40 0 -60 10"/> <path class="wing-pattern-vein" d="M -5 -35 Q -60 40 -100 50"/> </path> <!-- Left Hindwing --> <path class="hindwing" d="M -5 30 C -20 120 -100 150 -140 100 C -160 70 -100 40 -5 30 Z"> <!-- Hindwing Patterns --> <circle class="wing-pattern-spot" cx="-90" cy="80" r="10" /> <path class="wing-pattern-band" d="M -30 50 Q -80 100 -120 90 Q -90 70 -30 50 Z" /> </path> </g> <!-- Right Wings --> <!-- Transform: translate by 600 (full viewBox width) then scale by -1 horizontally. This effectively mirrors the left wings across the vertical center axis (x=300) --> <g class="right-wings" transform="translate(600, 0) scale(-1, 1)"> <!-- Right Forewing (mirrored Left Forewing) --> <!-- The path data is the same as the left forewing, transformation handles mirroring --> <path class="forewing" d="M -5 -35 C -60 -100 -180 -80 -150 50 C -130 90 -40 60 -5 -35 Z"> <!-- Forewing Patterns (coordinates are relative to the *mirrored* wing path) --> <circle class="wing-pattern-spot" cx="-90" cy="-30" r="15" /> <circle class="wing-pattern-spot" cx="-60" cy="10" r="8" /> <path class="wing-pattern-band" d="M -40 -10 C -80 20 -120 30 -100 50 C -90 40 -60 10 -40 -10 Z" /> <path class="wing-pattern-vein" d="M -5 -35 Q -50 -60 -90 -50"/> <path class="wing-pattern-vein" d="M -5 -35 Q -40 0 -60 10"/> <path class="wing-pattern-vein" d="M -5 -35 Q -60 40 -100 50"/> </path> <!-- Right Hindwing (mirrored Left Hindwing) --> <path class="hindwing" d="M -5 30 C -20 120 -100 150 -140 100 C -160 70 -100 40 -5 30 Z"> <!-- Hindwing Patterns (coordinates are relative to the *mirrored* wing path) --> <circle class="wing-pattern-spot" cx="-90" cy="80" r="10" /> <path class="wing-pattern-band" d="M -30 50 Q -80 100 -120 90 Q -90 70 -30 50 Z" /> </path> </g> </g> </svg>Explanation:
<svg>: The root element.width,heightprovide a default size, andviewBoxmakes it scale responsively. TheviewBox="0 0 600 450"defines a coordinate system where the top-left is (0,0) and the bottom-right is (600, 450).<title>and<desc>: Provide accessibility information.<style>: Contains CSS rules. Using CSS classes makes the code cleaner and easier to modify colors and stroke styles.<g class="butterfly-group" transform="translate(300, 225)">: A main group that contains all parts of the butterfly. Thetransform="translate(300, 225)"moves the origin (0,0) of this group to the center of theviewBox(300 horizontally, 225 vertically). All subsequent coordinates within this group are relative to this new origin, making it easier to design the butterfly centered around (0,0).<g class="body-group">: Contains the elements for the body and head.<path class="butterfly-body">: Defines the shape of the body usingM(Move To) andC(Cubic Bezier Curve) commands.Zcloses the path. Coordinates are relative to the butterfly group's origin.<circle class="butterfly-head">: Defines the head shape.
<g class="antennae-group">: Contains the antennae paths.<path class="butterfly-antennae">: UsesM(Move To) andQ(Quadratic Bezier Curve) to create curved antennae.
<g class="left-wings">: Contains the paths for the left forewing and hindwing.<path class="forewing">and<path class="hindwing">: These are complexpathelements defining the wing outlines usingM,C, andZ. Their coordinates are relative to the butterfly group's origin (the center of the butterfly).- Nested elements (
<circle>and<path>) inside the wing<path>elements define the patterns on the wings. Note: While technically valid in SVG 1.1 to put shape elements inside a path, it's often cleaner and more robust (especially for complex patterns or interactivity) to place the pattern shapes within the same group as the wing path, rather than inside the path itself, and ensure they are positioned correctly relative to the wing. However, for simple static patterns as shown, putting them inside works and conceptually links them to the wing shape. The coordinates of these pattern elements are relative to the same coordinate system as the wing path itself.
<g class="right-wings" transform="translate(600, 0) scale(-1, 1)">: This group contains the elements for the right wings.transform="translate(600, 0) scale(-1, 1)": This is the key for mirroring.scale(-1, 1): Flips everything horizontally across the Y-axis. If the origin were (0,0), this would flip across the left edge of theviewBox.translate(600, 0): Shifts the flipped content 600 units to the right. Since theviewBoxis 600 units wide, this effectively flips the content across the vertical line at x=300 (the center of the 600-wide viewBox). The left wing coordinates (relative to the butterfly center at x=300) are then correctly mapped to the right side.
- The
<path>and pattern elements within this group use the exact same path data and coordinates as their left counterparts. Thetransformattribute handles the mirroring.
This code provides a relatively detailed and well-structured SVG representation of a butterfly, which can be easily customized by changing colors, path data, and adding/modifying pattern elements.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- o4-mini-2025-04-16Compare side by side →
qwq-32bCompare side by side →
- o3-miniCompare side by side →
llama-4-maverick-03-26-experimentalCompare side by side →
gemini-2.0-flash-001Compare side by side →
gemini-2.5-pro-preview-03-25Compare side by side →
- grok-3-preview-02-24Compare side by side →
- o3-miniCompare side by side →
gemini-2.0-flash-001Compare side by side →
- grok-3-preview-02-24Compare side by side →
- grok-3-mini-betaCompare side by side →