Below is a detailed and realistic SVG code for a butterfly. I've designed it based on a generic butterfly (inspired by a Monarch butterfly for its vibrant colors and patterns) to make it visually appealing. The SVG includes:
- Symmetrical wings: Using
<path> elements for the forewings and hindwings, with bezier curves to create smooth, natural shapes.
- Body, head, antennae, and legs: Simple shapes like ellipses and paths for a realistic insect-like appearance.
- Details for realism:
- Veins on the wings using stroked paths.
- Gradients for shading on the wings to simulate light and depth.
- Patterns like spots and stripes on the wings.
- Colors: A mix of orange, black, and white to mimic a Monarch butterfly, with gradients for a 3D effect.
This SVG is scalable, so you can zoom in without losing quality. I've set a viewBox for a 400x400 canvas, but you can adjust the size as needed.
SVG Code:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400">
<!-- Define gradients for realistic shading on wings -->
<defs>
<linearGradient id="wingGradient" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:orange;stop-opacity:1" />
<stop offset="50%" style="stop-color:darkorange;stop-opacity:1" />
<stop offset="100%" style="stop-color:orangered;stop-opacity:1" />
</linearGradient>
<linearGradient id="bodyGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:black;stop-opacity:1" />
<stop offset="100%" style="stop-color:gray;stop-opacity:1" />
</linearGradient>
</defs>
<!-- Butterfly body -->
<g transform="translate(200, 200)"> <!-- Center the butterfly on the canvas -->
<!-- Abdomen -->
<ellipse cx="0" cy="0" rx="8" ry="40" fill="url(#bodyGradient)" stroke="black" stroke-width="1" />
<!-- Thorax -->
<ellipse cx="0" cy="-30" rx="10" ry="15" fill="url(#bodyGradient)" stroke="black" stroke-width="1" />
<!-- Head -->
<circle cx="0" cy="-45" r="6" fill="black" stroke="black" stroke-width="1" />
<!-- Antennae -->
<path d="M-5 -50 Q-10 -60 -15 -50" stroke="black" stroke-width="1" fill="none" />
<path d="M5 -50 Q10 -60 15 -50" stroke="black" stroke-width="1" fill="none" />
<!-- Legs (simple lines for basic structure) -->
<line x1="-10" y1="-20" x2="-20" y2="0" stroke="black" stroke-width="1" />
<line x1="10" y1="-20" x2="20" y2="0" stroke="black" stroke-width="1" />
<line x1="-10" y1="0" x2="-15" y2="20" stroke="black" stroke-width="1" />
<line x1="10" y1="0" x2="15" y2="20" stroke="black" stroke-width="1" />
</g>
<!-- Left Forewing -->
<path d="M100 150 Q50 100 20 150 Q0 200 50 250 Q100 300 150 250 Z"
fill="url(#wingGradient)" stroke="black" stroke-width="1" />
<!-- Left Hindwing (slightly smaller and lower for realism) -->
<path d="M80 200 Q40 180 20 200 Q0 220 40 240 Q80 260 120 240 Z"
fill="url(#wingGradient)" stroke="black" stroke-width="1" />
<!-- Right Forewing (mirrored for symmetry) -->
<path d="M300 150 Q350 100 380 150 Q400 200 350 250 Q300 300 250 250 Z"
fill="url(#wingGradient)" stroke="black" stroke-width="1" />
<!-- Right Hindwing (mirrored) -->
<path d="M320 200 Q360 180 380 200 Q400 220 360 240 Q320 260 280 240 Z"
fill="url(#wingGradient)" stroke="black" stroke-width="1" />
<!-- Wing details: Veins and patterns for realism -->
<g stroke="black" stroke-width="0.5" fill="none">
<!-- Veins on left forewing -->
<path d="M100 150 L50 200" />
<path d="M50 200 L20 150" />
<path d="M20 150 L50 250" />
<path d="M50 250 L100 300" />
<!-- Veins on left hindwing -->
<path d="M80 200 L40 180" />
<path d="M40 180 L20 200" />
<path d="M20 200 L40 240" />
<path d="M40 240 L80 260" />
<!-- Veins on right forewing -->
<path d="M300 150 L350 200" />
<path d="M350 200 L380 150" />
<path d="M380 150 L350 250" />
<path d="M350 250 L300 300" />
<!-- Veins on right hindwing -->
<path d="M320 200 L360 180" />
<path d="M360 180 L380 200" />
<path d="M380 200 L360 240" />
<path d="M360 240 L320 260" />
</g>
<!-- Add spots and patterns on wings for detail -->
<circle cx="60" cy="180" r="10" fill="white" stroke="black" stroke-width="1" /> <!-- Spot on left forewing -->
<circle cx="340" cy="180" r="10" fill="white" stroke="black" stroke-width="1" /> <!-- Spot on right forewing -->
<circle cx="40" cy="210" r="8" fill="black" /> <!-- Small spot on left hindwing -->
<circle cx="360" cy="210" r="8" fill="black" /> <!-- Small spot on right hindwing -->
</svg>
Explanation:
- Size and ViewBox: The SVG is set to a 400x400 viewBox, so it fits well in most browsers or editors. You can embed this in an HTML file or open it directly in a browser.
- Gradients: The
wingGradient adds a gradient from orange to darker shades for a realistic, shaded look on the wings. The bodyGradient gives the body a subtle 3D effect.
- Paths and Shapes:
- Wings are drawn using quadratic Bezier curves (
Q in the path d attribute) to create smooth, organic shapes.
- Veins are simple straight lines (
<path>) inside the wings for detail.
- Spots are added as circles to mimic common butterfly patterns.
- Symmetry: The right wings are manually mirrored versions of the left ones for balance.
- Customization:
- If you want to change colors, edit the gradient stops (e.g., change "orange" to another color).
- For more complexity, you could add more paths for additional veins or patterns.
- To animate it (e.g., make the wings flap), you could add CSS or SMIL animations, but that's beyond this basic code.
Copy and paste this code into a text editor, save it as an .svg file, and open it in a browser to see the result. If you'd like modifications, such as a different butterfly species or more details, let me know!