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

Kevin Smothers
Kevin Smothers
1,269 Points

I have this set... .star { transform-origin: 50% 50%; } I also tried the absolute position using 180px 180px also

No matter what I try, it keeps failing me on this.

It makes no sense, even though it's working in preview and it's semantic. Am I missing something or is it a bug in the Challenge?

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 class="star">
      <circle class="star-bg" fill="#40adcf" stroke="#fff" stroke-width="6" cx="180" cy="180" r="108.3"/>
      <path class="star-icon" 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 {
  transition: transform .8s ease-out;
  transform-origin: 50% 50%;
}

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

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

2 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi Kevin Smothers,

The code challenge didn't ask for an ease-out timing function. When included, it threw off the next task. I just fixed it to accept it, though. Thanks! :)

Taki mhd
PLUS
Taki mhd
Courses Plus Student 1,714 Points

Hi Kevin,

Try declaring transform-origin before the transition property.

This may just be a bug in the workspace for this specific question.

So instead of this

  .star {
      transition: transform .8s ease-out;
      transform-origin: 50% 50%;
    }

Try this

.star {
   transform-origin: 50% 50%;
   transition: transform .8s ease-out;

}