Can I use a transformation as the value of a transition property?

Can a transformation be used as the value of a transition property?

transition-property: transform; 

The W3C transition standard does not display the transformation as an Animated value.

In fact, the W3C conversion standard has a missing row for Animatable: Yes / No in table 7. The transform property.

I worry that this is legal or not.

Stack Overflow

I can get the transformation animation using the 0% and 100% keyframe, but if only 2 states are involved, I would prefer the transition instead of the animation.

+4
source share
2 answers

You must specify the exact name for each engine. So, for example, for Safari and Chrome you should write the following:

 -webkit-transition-property: -webkit-transform; 

Here is a working example in JSFiddle .
Note. I used shorthand for the transform property.

+1
source

It seems you can, however I'm not too sure about cross-browser compatibility. You can play with him here . Using the code already provided, when you hover over the red frame, it moves.

0
source

Source: https://habr.com/ru/post/1489299/


All Articles