36

Is it possible to view or debug the steps a single element takes when in a transition-css animation? I'm working with Chrome Dev Tools, but I'm pretty new at it. I googled it and saw something from the timeline, but I don't find the step by step things.

My animation starts at 0%, and goes to 100%, but there seems to be something strange around 50%, although the 50% step is not declared. That's why I would like to view what's going on.

7
  • 2
    how about instead of asking 'show me google chrome's dev tools', how about' here's an animation that's glitching. Any idea why that's happening? The latter is probably more effiecient at fixing the issue :) Commented Oct 21, 2014 at 12:41
  • 13
    Well I'm sure that you guys would be able to fix this pretty fast, but I would like to learn if and how it is possible to debug CSS animations, kinda like step by step, just to learn it myself. So that I can fix my own issues :-) Commented Oct 21, 2014 at 12:53
  • 1
    Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime. ;-) Commented Oct 21, 2014 at 12:55
  • 4
    I've one for you - if you build a man a fire, he'll be warm for a night. set a man on fire, and he'll be warm for the rest of his life. The point is, if we can point out the 'mistake' now, you'll be less likely to have the error in the future! :) Commented Oct 21, 2014 at 12:58
  • 4
    Hehe. Well thank you, but actually I just found the solution myself a few minutes ago. It had to do with some recalculation of the center (margin: auto) and the resizing of an element. So with a little guessing, trial and error, I managed to fix the problem. Still it would have been better if I'd know how to debug those things. If there exists a possibility, I'd really like to know ... don't find it myself ... Commented Oct 21, 2014 at 13:05

4 Answers 4

36

Yes it's possible.

It is possible to debug transitions and CSS animations with Chrome DevTools.

enter image description here

Then, an "Animations" tab will open in the Console panel (you can open it by pressing Esc if you have DevTools focused - just click on DevTools to focus it):

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

amazing ... :) I did not know this.. it saved my hell lot of time.
I found that for some reason my latest version of Chrome no longer had that button. I had to click the 3 dot icon at the top right, then More Tools, then select Animations
The button for it in the "Filter" section appears to have been removed. It is still available in the three dot menu at the top right under "More Tools" -> "Animations". It is also available in the three dot menu next to the "Console" as just "Animations".
8

After doing a little bit of research, it doesn't look like this is currently possible using Chrome DevTools. Here are some random tidbits of information I've found:

For what it's worth, here's a few suggestions, although I've not tested these and I'm fairly ignorant about the topic:

  • If possible, pause the animation by way of altering the element's animation-play-state property:

    .paused {
        -webkit-animation-play-state:paused;
        -moz-animation-play-state:paused;
        -o-animation-play-state:paused; 
        animation-play-state:paused;
    }
    
  • Drag the animation out over a longer span of time so that the transition behavior is more clear.

  • There's also the option of using <canvas> animations (which apparently Chrome DevTools has better debugging support for) if it's mission critical to do things like step through the animation.

Comments

2

Download Chrome Canary to have access to the new animation controls feature. See this video to preview how it works :

https://vimeo.com/116038639

2 Comments

This does not let you slow down enough, and there is no shortcut to pause it, it is completely mouse driven. I have an animation bug that is currently almost impossible to debug without precision timing / shortcuts!!
Additional text describing how it works can be found at valhead.com/2015/01/06/quick-tip-chrome-animation-controls . Also, it is now in regular Chrome Version 43.0.2357.132.
1

Last updated January 11, 2018.

The Chrome DevTools Animation Inspector has two main purposes.

  1. Inspecting animations. You want to slow down, replay, or inspect the source code for an animation group.
  2. Modifying animations. You want to modify the timing, delay, duration, or keyframe offsets of an animation group. Bezier editing and keyframe editing are currently not supported.

For e.g. It is not possible to modify the value of CSS 2D transforms' scale method in keyframe. Try running the snippet given below:

.animates {
  animation-timing-function: ease-out;
  animation-duration: 1s;
  animation-iteration-count: infinite;
}
.wrapper {
  position: relative;
  margin-top: 10px;
}
.btn-overlay {
  animation-name:grow;
  -webkit-animation-name:grow;
  position: absolute;
  width: 50%;
  top: 0;
  left: 27%;
}
@keyframes grow {
  0%{
    transform: scale(1.0);
    -moz-transform: scale(1.0);
    -webkit-transform: scale(1.0);
    left: 27%;
  }
  80% {
    transform: scale(1.0);
    -moz-transform: scale(1.0);
    -webkit-transform: scale(1.0);
    left: 27%;
  }	
  90% {
    transform: scale(1.04);
    -moz-transform: scale(1.04);
    -webkit-transform: scale(1.04);	
    left: 27.5%;
  }
  100%{
    transform: scale(1.0);
    -moz-transform: scale(1.0);
    -webkit-transform: scale(1.0);	
    left: 27%;
  }	
}
.button{
  background-color: #f49a22!important;/* Old browsers */
  background: -moz-linear-gradient(left, #efaf00 0%, #dd5c00 100%); /* FF3.6-15 */
  background: -webkit-linear-gradient(left, #efaf00 0%,#dd5c00 100%); /* Chrome10-25,Safari5.1-6 */
  background: linear-gradient(to right, #efaf00 0%,#dd5c00 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efaf00', endColorstr='#dd5c00',GradientType=1 ); /* IE6-9 */

  box-shadow: 0px 3px 6px rgba(156, 116, 86, 0.4);
  display: inline-block;
  color: white;
  padding: 0 14px;
  height: 30px;
  border-radius: 80px!important;
  font-size: 12px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="wrapper">
  <div class="animates btn-overlay">
    <input type="submit" value="SIGN UP HERE!" name="subscribe" class="button">
  </div>
</div>

</body>
</html>

The Animation Inspector supports CSS animations, CSS transitions, and web animations. requestAnimationFrame animations are currently not supported.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.