Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-flash-preview-04-17· GoogleHugging Face LMArena Human Preference 140K

write detailed svg code for butterfly

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with grok-3-preview-02-24’s answer.
  1. User

    write detailed svg code for butterfly

  2. Gemini Assistant

    Okay, here is detailed SVG code for a butterfly. This example includes:

    1. Body and Head: Using a path and a circle.
    2. Antennae: Using paths.
    3. Wings: Two forewings and two hindwings, created using path elements for organic shapes.
    4. Symmetry: Designing one side (left wings and antennae) and using transform to mirror them for the other side.
    5. Wing Patterns: Adding some simple spots and bands within the wings using circle and path elements.
    6. Styling: Using CSS within <style> tags for colors and stroke.
    7. Grouping: Using <g> elements to organize the different parts (body, antennae, wings).
    8. ViewBox: Setting up a viewBox for 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:

    1. <svg>: The root element. width, height provide a default size, and viewBox makes it scale responsively. The viewBox="0 0 600 450" defines a coordinate system where the top-left is (0,0) and the bottom-right is (600, 450).
    2. <title> and <desc>: Provide accessibility information.
    3. <style>: Contains CSS rules. Using CSS classes makes the code cleaner and easier to modify colors and stroke styles.
    4. <g class="butterfly-group" transform="translate(300, 225)">: A main group that contains all parts of the butterfly. The transform="translate(300, 225)" moves the origin (0,0) of this group to the center of the viewBox (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).
    5. <g class="body-group">: Contains the elements for the body and head.
      • <path class="butterfly-body">: Defines the shape of the body using M (Move To) and C (Cubic Bezier Curve) commands. Z closes the path. Coordinates are relative to the butterfly group's origin.
      • <circle class="butterfly-head">: Defines the head shape.
    6. <g class="antennae-group">: Contains the antennae paths.
      • <path class="butterfly-antennae">: Uses M (Move To) and Q (Quadratic Bezier Curve) to create curved antennae.
    7. <g class="left-wings">: Contains the paths for the left forewing and hindwing.
      • <path class="forewing"> and <path class="hindwing">: These are complex path elements defining the wing outlines using M, C, and Z. 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.
    8. <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 the viewBox.
        • translate(600, 0): Shifts the flipped content 600 units to the right. Since the viewBox is 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. The transform attribute 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.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.