Jump to content
Search Community

Png transparency goes black when rotating div in IE8

marcusfriberg test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi guys,

 

I am animating a div with a transparent background (the ball). When I use rotation the transparent background seems to get a black background in IE8. This only appears when I use css rotation in my animation. 

 

Is there someone who have seen this before and knows how to get rid of this problem? Is it possible to use rotation in any other way than css?

This is what my animation looks like;

tlBall.to(ball, 0.2, {css:{left:"400px",top:"366px",rotation:360}, delay:0, ease:Sine.easeInOut})

 

This is that the background with the ball looks like;
http://cl.ly/image/1U2a0w0T3O17/image004.png

Thanks!

 

- Marcus
 

 

Link to comment
Share on other sites

Hello marcusfriberg, and Welcome to the GreenSock Forums!

 

That is an issue with IE8 and how it handles transparent PNG images. To remove the black matte you have to do either of the following:

 

Try using the CSS IE filters:

#ball {
    background: url('images/ball.png') no-repeat 0 0 transparent;
    /* IE7 */
    filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = #00FFFFFF,endColorstr= #00FFFFFF)progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled= 'true', sizingMethod = 'crop', src = 'images/ball.png');
    /* IE8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='images/ball.png')";
}

Or using JavaScript to apply the filter in IE on all png images:

var i;
for (i in document.images) {
    if (document.images[i].src) {
        var imgSrc = document.images[i].src;
        if (imgSrc.substr(imgSrc.length - 4) === '.png' || imgSrc.substr(imgSrc.length - 4) === '.PNG') {
            document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";
        }
    }
}

Hope this helps? :)

  • Like 3
Link to comment
Share on other sites

Hi,

 

this piece of CSS works perfect for me:

background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)";
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
zoom: 1;

Add to the img which you animate, and no more HALO effect.

 

Cheers,

 

ThemePunch

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...