Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Animating SVG with CSS Transitions and Transforms Transitions and Transforms

Jordan Parker
Jordan Parker
1,669 Points

Not sure what the issue is, when I check the work it says it's incorrect, however when Previewed it runs fine...

When checking work, error message says "Make sure you're giving .star a transform-origin property" but I did this and when Previewed it all runs perfectly and works, yet it says there is an error in the code...

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Animating SVG with CSS</title>
    <link rel="stylesheet" href="base.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="60 60 240 240">
    <g>
        <circle class="star-bg" fill="#40adcf" stroke="#fff" stroke-width="6" cx="180" cy="180" r="108.3"/>
        <path class="star" fill="#fff" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M180 107.8l16.9 52.1h54.8l-44.3 32.2 16.9 52.1-44.3-32.2-44.3 32.2 16.9-52.1-44.3-32.2h54.8z"/>
    </g>
  </svg>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */
.star-bg {
transition: fill 1s ease-out;
}

.star-bg:hover {
  fill: steelblue;
}

.star {
  transition: transform .8s ease-out;
  transform-origin: 180px 180px;
}

.star:hover {
  transform: rotate(180deg);
}

3 Answers

Jordan's code needs adjusting.

you need to switch the lines (or you get a Bummer! about not using transform-origin):

.star {
  transform-origin: 180px 180px;
  transition: transform .8s ease-out;
}

See Forrest Phillips' reply in this thread (which gave me the clue):

https://teamtreehouse.com/forum/transformorigin-problem

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi Jordan Parker,

The code challenge never asked to specify an ease-out timing function. If you remove it, you should be good to go. :)

Jordan Parker
Jordan Parker
1,669 Points

HA! My bad :) Awesome. Much appreciated Guil!