Results 1 to 9 of 9

Thread: need cross-browser animation with transparency

  1. #1
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default need cross-browser animation with transparency

    Hello,

    I created a png animation but I’m finding it only works in firefox. All my research tells me that png animations aren’t supported by any other browser.

    I would use gif, but gifs don’t support transparency.

    I’m told my only other option is Flash, but I’m not a Flash developer.

    Does anyone know any other way to get an animation with transparency that works across all browsers?

    Thanks.

  2. #2
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    Animated GIFs do support transparency but it has to be encoded in such a way that each frame is erased before the next is displayed.

    See here.

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Gif (animated or otherwise) supports 1-bit transparency, meaning that a pixel is either transparent or opaque (no middle ground)

    Png-24/32 supports alpha-transparency, which means that pixels can have varying degrees of opacity.

    Can you be clearer with what you are working with - maybe an example of the file. A link would be best.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Beverleyh View Post
    Gif (animated or otherwise) supports 1-bit transparency, meaning that a pixel is either transparent or opaque (no middle ground)

    Png-24/32 supports alpha-transparency, which means that pixels can have varying degrees of opacity.

    Can you be clearer with what you are working with - maybe an example of the file. A link would be best.
    I'm attaching the png file.

    Name:  flash.png
Views: 77
Size:  14.2 KB

    If you're viewing this in Firefox, it should be animating.

  5. #5
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    What colour background will it be visible on? Looks like it should be white? Try remaking/converting it to gif on a white base http://apng2gif.sourceforge.net/
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  6. #6
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    Quote Originally Posted by gib65 View Post
    Quote Originally Posted by Beverleyh View Post
    Gif (animated or otherwise) supports 1-bit transparency, meaning that a pixel is either transparent or opaque (no middle ground)

    Png-24/32 supports alpha-transparency, which means that pixels can have varying degrees of opacity.

    Can you be clearer with what you are working with - maybe an example of the file. A link would be best.
    I'm attaching the png file.

    Name:  flash.png
Views: 77
Size:  14.2 KB

    If you're viewing this in Firefox, it should be animating.
    Yes, you're right, as you said in the first post, it only animates in Firefox. However, both Beverley and I have told you that animated GIFs will support transparency if encoded correctly. So you need to try a different approach. There are lots of free GIF animators on the web, but the best is probably GIMP. There's a tutorial here.

  7. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    To clarify, http://apng2gif.sourceforge.net/ supports transparency but the alpha-transparent pixels in your apng will convert to 1-bit transparency; You can set the colour of the base (eg white) so that a previously 50% opaque red pixel will be converted to a fully opaque pixel with 50% red and 50% white (a mix of the original alpha-transparent pixel colour and the selected base colour). Any fully transparent pixels from the apng will remain fully transparent in the gif.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  8. #8
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Beverleyh View Post
    To clarify, http://apng2gif.sourceforge.net/ supports transparency but the alpha-transparent pixels in your apng will convert to 1-bit transparency;
    Yes, this is why I'm hesitating on using the GIF approach. The background won't be a consistent color.

    I actually took a different approach. I'm using a static png and animating the opacity with CSS. That seems to work for my purposes.

    Thanks for the pointers anyway. It taught me a thing or two about GIFs.

  9. #9
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You're very welcome
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Both Cross Browser Marquee and CBM II
    By Nightfox in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 01-15-2011, 01:55 PM
  2. Not cross browser...
    By grumpyted in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-10-2010, 10:16 PM
  3. Cross browser CSS
    By Medyman in forum CSS
    Replies: 6
    Last Post: 01-12-2008, 05:11 AM
  4. Cross Browser marquee II help please
    By SilverWolf in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 11-12-2007, 05:13 PM
  5. Cross Browser marquee
    By alhakeem2001 in forum JavaScript
    Replies: 2
    Last Post: 07-03-2006, 10:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •