webAnimation

webAnimation

Creating web-ready animation files

This set of simple exercises focuses on the creation of animated graphic file types. GIF files are the most common of these to find on the Web because they are among the oldest file types developed for web content. However, there are many liabilities in this file type.

Many alternatives have been developed to address the issues that GIF files create. When we animate PNG files, we know them as APNGs, which are much higher quality. WEBP animations have better compression, but the relatively new AVIF is better still. And, for scalability, nothing beats an animated SVG — though it’s a special case, as we’ll see.

Comparison of file types

Which is the best file type to use? The answer is that there is no “best.” How you choose depends on a variety of factors. Do you need color depth? Is performance on mobile browsers critical? Does the image contain variable opacity (that is, semi-transparent elements, like the reflection in our bouncing ball above)? Must the file render in all browsers? How you answer those questions will determine the “best” file choice.

<< Scroll table on mobile >>

Ironically, due to the history of file type development, the file types that do the worst in most categories are the files that have the most support on the web! Watch this space, however: the newer generation of file types was only developed after the rise of the mobile device. File types like WEBP and AVIF hit the sweet spot of combining high quality with high compression. It’s only a matter of time before they replace older file types like the GIF. Having said that, the GIF is still wildly popular — and predictions of its imminent demise have persistently proven to be incorrect!

Simple GIFs

Animated GIF creation is much simpler than people assume. The hardest part is in the individual frame creation, not the actual GIF creation. After discussing frame-making, we’ll introduce two paths to making a simple animated GIF.

Creating frames

We create individual frames for an animated file in an image editing program like Photoshop. In their web installation d1ASp0RA, TangenT ArT CollaboraTive combined a GIF created from single stop-frames by Eadweard Muybridge’s Animal Locomotion series with a client-controlled erasure element and animated text for a haunting exploration of the immigration experience.

TangenT ArT Collaborative, animated GIF element from d1ASp0RA: 1d10l0GY, 2016

Eadweard Muybridge, Human Boy from Animal Locomotion, ca. 1887. From Wikimedia Commons.

While no two frame-creation jobs seem to be alike, the frames for this GIF are fairly representative of the workflow for frame-creation from existing photographic sources:

  • The frames were created by taking apart a large JPG file with 12 frames of motion.
  • Each frame was carefully cropped to fit inside the format and size required by the website.
  • To achieve smoother motion, each frame was aligned using clues from the background.
  • Pixel material was added to the top of each frame by cloning the dark background.
  • The sepia tone was desaturated to pure grayscale.
  • Exposure was “averaged” to avoid flash-framing, although some of the differences, in contrast, were kept to maintain a sense of “antique” imagery in the final GIF.

The work done on the frames, each saved as a JPG, is available for download and inspection in the sample file link at the top of this wiki title.

Making animated GIFs at Ezgif

Ezgif.com sponsors a super-simple GIF maker and conversion toolkit is this author’s favorite place on the web (besides newMediaWiki, of course!). Among other things, you can quickly and easily:

Ezgif is so simple to use we don’t even need to write a tutorial. Just download the .zip file with frames, head to GIF Maker, and follow the instructions on the page. You’ll be shocked how easily you can make a GIF, once you have a decent set of frame images to upload.

YOUR TURN: Ezgif

Use Ezgif to make your own Muybridge GIF from the download sample.

Animated GIFs in Photoshop

Sometimes you need more control than a browser app can provide. Photoshop is a robust GIF creation and editing tool. Here we see an interesting variation on GIF creation known as a cinemagraph, in which only a portion of the image is in motion.

YOUR TURN: Photoshop

The adjacent link leads to a well-written tutorial at Adobe for GIF creation from a set of still images or a short video. Use the sample frames at the Adobe tutorial website to create a GIF in Photoshop.

Animated GIF with transparency

GIF supports an alpha channel, so we can use it if we want to create animated elements with transparency. TangenT ArT CollaboraTive used this to interesting effect in the web installation */rEDaCT/*, which you can visit at the adjacent link. Multiple transparent GIFS are animated using HTML5/CSS animation techniques in a multimedia environment. Refresh the website’s screen, and you’ll see a rotating Catherine Wheel animation juxtaposed against other animations using a JS-based randomizing script in the website.

TangenT ArT CollaboraTive, Catherine
Wheel
, animated GIF element from */rEDaCT/*, 2015

The original image found at 
St. Catherine’s Monastery site

As we can see, the creation of a transparent GIF is no different than a “normal” one, save that the frames have transparent elements. Above, you can see the original file from which the animation was generated. After deleting the background, we generated frames using a Photoshop Transform Rotate by 3 degrees per frame, for a total of 120 frames for one full rotation.

YOUR TURN: Photoshop

Find and download the Catherine Wheel sample file at the top of this wiki title. Then, use the sample frames to create a transparent looping GIF in Photoshop.

New kids on the transparency block

The new kids on the block are animated PNG, or APNG, along with WEBP and AVIF. Despite their clear advantages of quality and compression, browsers have been a bit slow in adopting them. Until as late as 2017, many major browsers did not support APNG. WEBP animation only achieved wider support in 2020 — and even then, Safari support was dependent on the MacOS it was running on. AVIF animation is now running on most major browsers as of this writing (2023), but Edge is still lagging. As more browsers align with these high-quality high-compression file types, we anticipate a rapid increase in their proliferation.

All three animated file types work similarly to GIFs while supporting sophisticated variable transparency not available in GIFs. Now, compare the appearance of our bouncing ball APNG across a range of background values to that of a similar GIF file. Compared to the unsightly edge on the GIF, you can immediately see the advantage in the anti-aliased transparent edges and the transparency in the reflection.

For each of the filetypes below, we’ll use the same set of frames found in the Bouncing Ball sample file, which you can download from the link at the top of this wiki title.

APNG

Creating with Ezgif

There are two ways to make an APNG file with Ezgif

NOTE: It can’t be stressed enough that converting an existing GIF with transparency will NOT clean up the edges or provide variable opacity! You should only use the GIF to APNG to make APNGs without transparency.

However, if you make your PNG frames from scratch in Photoshop, with transparency-anti-aliasing at edges and variable opacity in drop shadows, reflections, and similar effects, Ezgif makes remarkable files with APNG Maker. Use the Bouncing Ball frames in the download above to practice.

Creating with Photoshop

Historically, Photoshop has had some bugs in its output to APNG, but the latest update seems to have solved this. So, with that history in mind, let’s have a go at creating an APNG!

Theoretically, here is the workflow:

  • Go to File > Export > Render Video.
  • On the dropdown menu change from Adobe Media Encoder to Photoshop Image Sequence.
  • Click on the dropdown list for Format and change it to PNG.
  • Add a name for the file and location, then select Render to save it there.

We continue to monitor potential issues with Photoshop here. If you encounter issues with rendering despite assurances from Adobe that they’ve solved the problem, a reasonable workaround is to generate good-quality PNG frames and take them to Ezgif for the APNG Maker above.

YOUR TURN: APNG

Use the bouncing ball sample frames to create an APNG in Ezgif and Photoshop (if it will allow!). Name them ballbounce_ezgif.png and ballbounce_ps.png to distinguish them.

WEBP

Creating with Ezgif

There are two ways to make a WEBP file with Ezgif

Just as we warned with APNG files, we don’t recommend trying to convert transparency WEBP files with transparency GIF files. Better to use PNG, WEBP, or AVIF files built from scratch, like our bouncing ball frames.

Creating with Photoshop

Photoshop 23.2 and later supports WEBP. However, you may need a plug-in to create animated WEBP files. If that’s true, we don’t want you to mess with your Photoshop configuration.

YOUR TURN: WEBP

Use the bouncing ball sample frames to create a WEBP in Ezgif and Photoshop (if you don’t need a plug-in!). Name them ballbounce_ezgif.webp and ballbounce_ps.webp to distinguish them if needed.

AVIF

Creating with Ezgif

There are two ways to make an AVIF file with Ezgif

Again, we don’t recommend trying to convert transparency AVIF files by using transparency GIF files. Use PNG, WEBP, or AVIF files like our bouncing ball frames.

Creating with Photoshop

Photoshop will only work with AVIF by installing a plugin, and if you’re on a networked machine in the studio I teach you don’t have administrative rights to install it.

YOUR TURN: AVIF

Use the bouncing ball sample frames to create an AVIF in Ezgif. Name it ballbounce_ezgif.avif.

Animated SVG

To round out our knowledge of animated file types on the web, we conclude with a discussion of the animated SVG.

SVG stands out among web animation file types for several reasons:

  • It is vector-based and highly scalable.
  • It is best understood as a file created in a markup language similar to HTML, and therefore:
    • It can employ CSS style conventions for animation.
    • It can be written directly inline into an HTML file, or it can be referenced as an image like other graphic file types.

An SVG animation using CSS. From Wikimedia Commons.

So, for now, if you haven’t yet learned how to work with HTML and CSS, creating an animated SVG goes beyond the scope of this wiki title. But fear not: we will cover the creation of animated SVGs in another project!

Sidebar