CodePen

HTML

            
              <div id="transition"></div>

Open your console :)
            
          
!

CSS

            
              #transition {
  top: 0;
  width: 50px;
  height: 50px;
  background: blue;
  -webkit-transition: top 1s linear;
  -moz-transition: top 1s linear;
  -ms-transition: top 1s linear;
  -o-transition: top 1s linear;
  transition: top 1s linear;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              /* 

A function that will take a transition-timing-function from an element and return it as a cubic-bezier() function should it not be one. This is needed because WebKit currently returns the transition-timing-function property as a keyword (such as "linear"), whereas other browsers will return the cubic-bezier(). If a browser returns a cubic-bezier(), this function will leave it alone so that you always get a cubic-bezier() consistently. This issue was detailed here: http://coding.smashingmagazine.com/2013/04/26/css3-transitions-thank-god-specification/#timing-functions

Open your console to see the original timing-function, followed by the converted one

Note: The code below doesn't make getting an element's transition-timing-function 100% bullet-proof because you will almost certainly need to query the prefixed versions of style.transitionTimingFunction too, such as style.webkitTransitionTimingFunction. In Sequence.js (where this code is taken from), we use Modernizr to query the prefix required for CSS3 transitions, then return the transition-timing-function for the prefix being used.

*/

var element = document.getElementById('transition'); //get the element you want the timing-function of

var style = element.currentStyle || window.getComputedStyle(element, null); //get the styles for that element

var timingFunction = style.transitionTimingFunction; //specifically select the transitionTimingFunction from the styles


function convertTimingFunctionToCubicBezier(timingFunction) {
  
  var timingFunctionToCubicBezier = {
      "linear" : "cubic-bezier(0.0,0.0,1.0,1.0)",
      "ease"   : "cubic-bezier(0.25, 0.1, 0.25, 1.0)",
      "ease-in": "cubic-bezier(0.42, 0.0, 1.0, 1.0)",
      "ease-in-out": "cubic-bezier(0.42, 0.0, 0.58, 1.0)",
      "ease-out": "cubic-bezier(0.0, 0.0, 0.58, 1.0)"
  };
  
  if(timingFunction.indexOf("cubic-bezier") < 0) { //if the timing-function returned isn't a cubic-bezier()
    timingFunction = timingFunctionToCubicBezier[timingFunction]; //convert it to one!
  }
  
  return timingFunction; //return a cubic-bezier() please, thank you muchly!
  
}

console.log("original:", timingFunction);
console.log("converted:", convertTimingFunctionToCubicBezier(timingFunction));
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................