Jump to content
Search Community

Black outline around PNGs on IE 11 (and below) Urgent

sorciereus 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

Hello. I always use GSAP for my banner animation - and today (of course when we are up against a crazy deadline) all of our banners that are tweening transparent png's are showing a black outline around the pngs. It's strange because I've seen this bug with IE8 (which we don't support) but only when the images have a drop shadow, the drop shadow becomes solid. I've never seen this before and seems to be affecting all of our units that I've used transparent pngs on in the past. 

 

Is there something going on with the platform? This error is in all versions of IE. I'm calling TweenMax from: 

https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js

 

Any fixes? Any ideas why this is happening? There are not drop shadows on these pngs. 

 

Here is an example line of code that is moving the pngs around

TweenMax.to('#clouds3', 2.2, {alpha:0, x:"+=300", y:"-=140", ease:Power1.easeIn, delay:.5});

post-17918-0-44363700-1466191086_thumb.jpeg

post-17918-0-44052100-1466191742_thumb.png

Link to comment
Share on other sites

Hello sorciereus,

 

This is a browser bug for IE which is caused by the browser defined filter on <img> tags, especially when opacity is applied to them.

 

Try adding this to your CSS styles-sheet to prevent that black outline in IE.

img {
   filter:0;
}

/* or use */

img {
   filter: alpha(opacity=0);
}

Also you should use autoAlpha instead of alpha:

// you have 
alpha: 0

// use autoAlpha instead
autoAlpha: 0
TweenMax.to('#clouds3', 2.2, {
   autoAlpha:0, 
   x:"+=300", 
   y:"-=140", 
   ease:Power1.easeIn,  
   delay:.5
});

You also might have to add filter:0 after the element is done animating the opacity

TweenMax.to('#clouds3', 2.2, {
   autoAlpha:0, // use autoAlpha instead of alpha
   x:"+=300", 
   y:"-=140", 
   ease:Power1.easeIn, 
   delay:0.5,
   onComplete: function(){
       TweenMax.set('#clouds3',{filter:0});
   }
});

Sometimes animating a <div> tag that is the parent of the <img> tag instead of animating the <img> tag directly can help since the opacity will be inherited by the <img> tag, especially in IE.

 

autoAlpha is part of the GSAP CSSPlugin

 

http://greensock.com/docs/#/HTML5/GSAP/Plugins/CSSPlugin/

 

autoAlpha

  • Identical to opacity except that when the value hits 0 the visibility property will be set to "hidden" in order to improve browser rendering performance and prevent clicks/interactivity on the target. When the value is anything other than 0, visibility will be set to "inherit". It is not set to "visible" in order to honor inheritance (imagine the parent element is hidden - setting the child to visible explicitly would cause it to appear when that's probably not what was intended). And for convenience, if the element's visibility is initially set to "hidden" and opacity is 1, it will assume opacity should also start at 0. This makes it simple to start things out on your page as invisible (set your css visibility:hidden) and then fade them in whenever you want.
//fade out and set visibility:hidden
TweenLite.to(element, 2, {autoAlpha:0});

//in 2 seconds, fade back in with visibility:visible
TweenLite.to(element, 2, {autoAlpha:1, delay:2});

if possible please create a codepen demo example so we can test your code live.

 

 

Thanks! :)

  • Like 3
Link to comment
Share on other sites

Is there a private email address I can send the demo to? I'm really not supposed to be sharing the creative publically - the fixes you sent don't seem to do the trick - would love for you take a look at the animation as perhaps i'm overlooking something. Thanks so much for the fast response. 

Link to comment
Share on other sites

Best thing to do is create a new png and place it in a simple codepen demo. We don't need to see your full production files. If this is happening in all of your ads it should be fairly easy to replicate.

 

This is the first I have heard of this in modern IE.

  • Like 1
Link to comment
Share on other sites

I'm curious what type of PNG are your images saved as.. PNG-8, PNG-24, or PNG-32?

 

Because even if that black outline behavior is back in IE11, it can still be resolved by adding the MS proprietary filters that resolve this issue in IE8 and below

img{
    background: transparent; 
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); 
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src='PATH_TO_YOUR_IMAGE_HERE.png');
    zoom: 1;
}

Or setting filter to 0

img {
   filter: 0;
   zoom: 1;
}

And or using the filter with your image:

img {
     background: url("PATH_TO_YOUR_IMAGE_HERE.png") no-repeat 0 0 transparent;
     filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src='PATH_TO_YOUR_IMAGE_HERE.png');
     zoom: 1;
}

:)

  • Like 4
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...