Skip to main content

Animated pictures

A logo, a picture in a video's content, a presenter badge or a brand's background picture can be an animated SVG, and its animation plays in the finished video. Upload the file to the Media library as you would any picture and use it where you would use a still one. Nothing else needs switching on.

What plays, and how​

An SVG moves in two ways, and Reelwire plays both: animation written inside the file with SVG's own animation elements (animate, animateTransform, animateMotion, set), and animation written with CSS (@keyframes).

Each frame of the video is drawn with the SVG's clock set to that frame's moment in the video. So the animation is smooth, it is the same every time the video is made, and it starts when the picture appears on screen. A logo that spins in over its first second does so at the moment the template shows it.

Everything else is drawn as before. A PNG, JPEG, WebP or GIF, and an SVG that does not move, appear exactly as they always did, so no video you already have changes.

Examples​

Each picture below is a complete SVG file, playing in your browser as it would in a video, with the whole file under it. To try one, copy the code into a text file, save it with a name ending in .svg, and upload it to the Media library.

All of them follow one pattern: an animation element sits inside the shape or group it moves, and says what changes (attributeName), through which steps (values, or from and to), and how long one round takes (dur).

Move​

A lime dot sliding to the right and back again

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<g>
<circle cx="80" cy="90" r="28" fill="#C6F432"/>
<animateTransform attributeName="transform" type="translate"
values="0 0; 160 0; 0 0" dur="3s" repeatCount="indefinite"/>
</g>
</svg>

The group moves 160 to the right and back, every three seconds. Its last step is the same as its first, so the loop has no seam. The dot is wrapped in a group and the group moves, which is the quickest way to move anything (see Keeping the video quick to make).

Turn​

A blue square turning around its centre

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<rect x="130" y="60" width="60" height="60" rx="8" fill="#4FD1FF">
<animateTransform attributeName="transform" type="rotate"
from="0 160 90" to="360 160 90" dur="4s" repeatCount="indefinite"/>
</rect>
</svg>

from="0 160 90" reads as 0 degrees around the point 160, 90, the square's centre. A full turn ends where it started, so this loop has no seam either.

Change colour​

A dot changing from lime to blue to orange and back to lime

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<circle cx="160" cy="90" r="40" fill="#C6F432">
<animate attributeName="fill"
values="#C6F432; #4FD1FF; #FF7A59; #C6F432" dur="4s" repeatCount="indefinite"/>
</circle>
</svg>

animate changes any attribute through its steps, here the fill colour. The same element can change a size, a position or a line's thickness.

Follow a path​

A lime dot travelling round an oval line

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<path d="M60 90 C60 30 260 30 260 90 S60 150 60 90" fill="none" stroke="#2A3245" stroke-width="4"/>
<circle r="12" fill="#C6F432">
<animateMotion path="M60 90 C60 30 260 30 260 90 S60 150 60 90"
dur="4s" repeatCount="indefinite"/>
</circle>
</svg>

animateMotion carries the dot along the path it names. The line is drawn only to show the way; the dot follows the path whether it is drawn or not.

Fade, with CSS​

A red dot pulsing beside the word LIVE

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<style>
.blink { animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
</style>
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<circle class="blink" cx="104" cy="90" r="14" fill="#FF4D4D"/>
<text x="130" y="102" font-family="sans-serif" font-size="34" font-weight="700" fill="#FFFFFF">LIVE</text>
</svg>

The same animation written in CSS: @keyframes names the steps, and animation gives them to everything of the class blink, for two seconds a round, for ever. Fading with opacity is quick to make.

Once, from the moment the picture appears​

A lime square growing in, then the word Hello appearing under it

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<g transform="translate(160 80)">
<g>
<rect x="-32" y="-32" width="64" height="64" rx="14" fill="#C6F432"/>
<animateTransform attributeName="transform" type="scale"
from="0" to="1" dur="1s" fill="freeze"/>
</g>
</g>
<text x="160" y="150" text-anchor="middle" font-family="sans-serif" font-size="22"
font-weight="700" fill="#FFFFFF" opacity="0">Hello
<set attributeName="opacity" to="1" begin="1s"/>
</text>
</svg>

With no repeatCount, an animation plays once, and fill="freeze" keeps its last step rather than jumping back to the first. set changes something at one moment, here a second in. In a video, these moments count from when the template shows the picture, so a logo like this grows in as it appears on screen. In this page they count from when the page opened: reload it to watch again.

The parts that set the timing​

In the fileWhat it does
attributeNameWhat changes: transform, fill, opacity, or a position such as cx
valuesThe steps it goes through, separated by semicolons. A last step equal to the first makes a loop with no seam
from, toA first and a last step, in place of values
durHow long one round takes, such as 3s
repeatCountindefinite repeats it for as long as the picture shows; left out, it plays once
beginWhen it starts, counted from the moment the picture appears: 1s is one second later
fill="freeze"Keeps the last step when it ends
@keyframes, animationThe same in CSS, inside a style element in the file

What is left out, and why​

An SVG is a small program, and Reelwire draws it inside the video's page, so it is cleaned first:

  • Scripts and anything that runs code are removed. Animation made by a script inside the file does not play. Use the file's own animation elements or CSS instead.
  • Links to other files and web addresses are removed. A picture inside the SVG must be embedded in it as a PNG, JPEG, WebP or GIF data address, which stays.
  • Frames, embedded pages and sound or video inside the SVG are removed.

If a file cannot be read at all, it is drawn as an ordinary picture, and a still SVG shows as it is.

Where it shows differently​

  • Fitting and focus. A picture in a frame fills it or fits whole inside it, like any picture. Where a template keeps a part of a picture in view when it crops, an SVG's focus is moved in three steps (left, middle, right and top, middle, bottom) rather than continuously.
  • Size. Give the SVG a viewBox, or a width and a height, so it knows its proportions.

Keeping the video quick to make​

How an SVG moves decides how long the video takes to make, much more than how detailed it is. Reelwire makes videos without a graphics card, so a visual effect (a blur, a glow, a drop shadow, a texture made from noise) that sits on something moving has to be drawn again on every frame. A detailed landscape whose effects stay still takes about as long as a plain one; the same landscape with a filter that moves through it can take ten times longer.

  • Slide whole groups. Wrap what moves in a group and animate that group's position, turn or size, rather than a shape that carries a filter.
  • Never animate a filter itself. Do not animate a blur's amount or the settings of a noise filter.
  • Fade with opacity on a group of its own rather than changing a filter.
  • Keep what changes shape apart. Put wings, waves or anything that morphs in a group of its own, so its changes do not make the picture under it be drawn again.
  • Loop without a seam. If the animation repeats, make it end exactly where it starts, so a video never catches the moment it starts over.

A soft glow that slides is quick when the glow stays the same and its group moves:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" width="320" height="180">
<defs>
<filter id="glow"><feGaussianBlur stdDeviation="6"/></filter>
</defs>
<style>
.slide { animation: slide 3s ease-in-out infinite; will-change: transform; }
@keyframes slide { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(160px); } }
</style>
<rect width="320" height="180" rx="16" fill="#0F1420"/>
<g class="slide">
<circle cx="80" cy="90" r="28" fill="#C6F432" filter="url(#glow)"/>
</g>
</svg>

It is slow when the filter itself changes, because the blur is worked out again on every frame:

<filter id="glow">
<feGaussianBlur stdDeviation="6">
<!-- Avoid: the blur's amount changes, so it is drawn again on every frame -->
<animate attributeName="stdDeviation" values="6;14;6" dur="3s" repeatCount="indefinite"/>
</feGaussianBlur>
</filter>