Is there an animatable transition-property for css filters?

CssCss Transitions

Css Problem Overview


I'm trying to animate CSS filters but can't find any information on the correct transition properties. What are they?

Here's an example: http://jsbin.com/onijim/3/

Css Solutions


Solution 1 - Css

-webkit-transition : -webkit-filter 500ms linear

works in webkit. I don't know about filter support in FF or Opera.

I'm not sure I wholly understand your question.

Solution 2 - Css

That's what I'm using. For Mozilla the 2nd is working for me, but in my sources I found it with the -moz- prefix, so it doesn't hurt to keep both.

-webkit-transition: 1s -webkit-filter linear;
-moz-transition: 1s -moz-filter linear;
-moz-transition: 1s filter linear;
-ms-transition: 1s -ms-filter linear;
-o-transition: 1s -o-filter linear;
transition: 1s filter linear, 1s -webkit-filter linear;

Solution 3 - Css

On last versions of Chrome which support transition without -webkit- prefix, if you are using transition-property (no shorthand transition) and properties like filter which still needs -webkit- prefix you need to mix unprefixed and prefixed code:

transition-property: width, left, transform, box-shadow, filter, -webkit-filter;

Note that the filter property is repeted with -webkit-filter. This is needed for browsers which do not use prefix, like Firefox, which in that case -webkit-filter is ignored.

Solution 4 - Css

Check if you have different values in the filter properties:

WRONG

.link-image {
    transition: 0.3s;
    filter: brightness(80%);
}

.link-image:hover {
    transition: 0.3s;
    filter: brightness(10);
}

CORRECT

.link-image {
    transition: 0.3s;
    filter: brightness(80%);
}

.link-image:hover {
    transition: 0.3s;
    filter: brightness(100%);
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Question0skarView Question on Stackoverflow
Solution 1 - CssmddwView Answer on Stackoverflow
Solution 2 - CssKarl AdlerView Answer on Stackoverflow
Solution 3 - CssAxeEffectView Answer on Stackoverflow
Solution 4 - Cssze_castroView Answer on Stackoverflow