Make a butterfly with symmetry
Draw half a butterfly, mirror it with use and a flip transform, then let the wings flap slowly. A hands-on way to see symmetry in SVG.
Ages 10 to 14, about 40 minutes. You will practice: What line symmetry is and how to spot it, How to mirror a shape with use and scale(-1 1), How to build a drawing from one reusable half, How to flap the wings with a gentle scale animation.
Goal: draw half a butterfly once, then let SVG mirror it to make the whole thing.
A butterfly is a famous example of line symmetry. If you folded a picture of one down the middle, the two halves would match exactly. You will draw only the right half. SVG will copy it, flip it and place it on the left. Any change you make to the right wing will appear on both wings. If you have not met <use> before, Make geometric patterns introduces it.
Step 1: Draw half
The canvas is 200 wide, so the line of symmetry runs straight down the middle at x="100". The dashed line shows it. Both wings are paths that start at the middle, at x equal to 100, and curve out to the right. The C command draws a smooth curve using two pulling points. The Z closes the shape.
The group has id="half", so we can copy it in the next step.
Try this: change the upper wing’s fill to #7bd389. Now sketch on paper what you think the left side will look like.
Step 2: Mirror it
<use href="#half"> draws another copy of the group. We flip the copy with transform="translate(200 0) scale(-1 1)". Read the two parts like this. scale(-1 1) multiplies every x by minus one, which flips the picture left to right across the left edge. Then translate(200 0) slides the flipped copy 200 to the right, so it lands exactly on the left side. A point at x=130 ends up at x=70, which is 30 on the other side of the middle.
Try this: change translate(200 0) to translate(190 0). The mirror slides off center and the symmetry breaks. Why? Then put it back to 200.
Step 3: Add the body
The body, head and antennae belong right on the line of symmetry. The body is a tall ellipse with its center at cx="100", so it is its own mirror. It comes after the wings, so it sits on top and hides the seam. The antennae are in the half group, so they are mirrored for free.
Try this: make the body wider with rx="10". Make the antennae longer by changing Q112 30 122 24 to Q114 24 126 14.
Step 4: Pattern the wings
Here is the payoff of the mirror trick. Put the wing spots inside the half group, and they appear on both sides. They are always perfectly matched, with no extra work.
Try this: add a spot of your own inside the half group, such as <circle cx="125" cy="115" r="6" fill="#7a3e00"/>. Check that the matching spot shows up on the left.
Step 5: Flap the wings slowly
A butterfly flaps by moving its wings in and out. We can fake that by squeezing the wings sideways toward the body. scale with two numbers stretches x and y separately, so 0.75 1 makes the wings 75 percent as wide and keeps the height.
Scaling squeezes toward the point 0,0, which is the left edge, so we need a trick to squeeze toward the middle. Nest three groups. The outer group moves the origin to the middle with translate(100 0). The middle group has the animation. The inner group moves everything back with translate(-100 0). The flap takes 4 seconds, so it is slow and calm. The body and head stay still, outside the wing groups.
Try this: change 0.75 to 0.5 for a bigger flap, or change 4s to 8s for a sleepy one. Keep the speed slow so it stays comfortable to watch.
For teachers and families
Ask: “Where else do you see line symmetry, such as in leaves, faces, letters or buildings? Which things are almost symmetrical but not quite?” As a classroom extension, ask children to find the letters of the alphabet that have a vertical line of symmetry (A, H, I, M, O, T, U, V, W, X, Y in plain capital letters), and ones that have none. Then they can try mirroring a pattern of their own. A challenge for confident learners is a four-way mirror, which uses a second use with scale(1 -1) to flip top to bottom as well.
Next project: Build a solar system model