Animated Image

<wa-animated-image> Stable Since 2.0

Animated images display GIFs and WEBPs with controls to play and pause them on demand. Use them when you want motion but need to give users control over when it plays.

This component uses <canvas> to draw freeze frames, so images are subject to cross-origin restrictions.

Examples

Link to This Section

WEBP Images

Link to This Section

Both GIF and WEBP images are supported.

Setting a Width and Height

Link to This Section

To set a custom size, apply a width and/or height to the host element.

Customizing the Control Box

Link to This Section

You can change the appearance and location of the control box by targeting the control-box part in your styles.

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://ka-f.webawesome.com/[email protected]/components/animated-image/animated-image.js';

After installing Web Awesome via npm, import this component:

import '@awesome.me/webawesome/dist/components/animated-image/animated-image.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/animated-image/animated-image.js';

To import this component for React 18 or below, use the following code:

import WaAnimatedImage from '@awesome.me/webawesome/dist/react/animated-image/index.js';

Slots

Link to This Section

Learn more about using slots.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Events

Link to This Section

Learn more about events.

CSS custom properties

Link to This Section

Learn more about CSS custom properties.

CSS parts

Link to This Section

Learn more about CSS parts.

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

Need a hand? Report a bug Ask for help
    No results