CSS-Keyframe-Animations-Generator

So wird es benutzt 4 Schritte
  1. Wählen Sie eine Animation.
  2. Legen Sie Dauer, Verzögerung, Zeitfunktion, Richtung und Füllmodus fest.
  3. Legen Sie einen Wiederholungen fest oder setzen Sie Endlos wiederholen.
  4. Drücken Sie Animations-CSS kopieren und fügen Sie es in Ihr Stylesheet ein.
Animiert
Generierter CSS-Code

So funktioniert dieses Werkzeug

Eine Animation besteht aus zweierlei: einem Satz Keyframes, der beschreibt, was sich ändert, und einer Kurzschreibweise, die sagt, wie sie abläuft. Die Keyframes sind hier vorgefertigt, und jeder Teil der Kurzschreibweise gehört Ihnen — Dauer, Verzögerung, Zeitfunktion, Richtung, Füllmodus und die Zahl der Wiederholungen. Diese Einstellungen prägen den Charakter der Bewegung weit stärker als die Wahl der Keyframes.

transform und opacity zu animieren hält die Bewegung flüssig: Beide kann der Browser verarbeiten, ohne das Layout neu zu berechnen, während width, height, top oder left ihn zwingen, diese Arbeit in jedem Einzelbild zu wiederholen. Alle sechs Keyframe-Sätze hier bleiben deshalb bei transform und opacity. Daneben wird ein Reduced-Motion-Block erzeugt, denn wer sein System um weniger Bewegung bittet, tut das aus einem Grund.

Einstellungen, die den Eindruck bestimmen

  • Der Füllmodus entscheidet, was an den Enden passiert: Standardmäßig springt ein Element nach dem Ende in seinen unanimierten Zustand zurück. forwards hält das letzte Keyframe, und genau das will eine einmalige Eingangsanimation fast immer.
  • Über die Richtung vermeiden Sie den Sprung: Eine Endlosanimation, die woanders endet als sie beginnt, springt jedes Mal zurück. alternate lässt sie stattdessen vorwärts und dann rückwärts laufen, sodass die Schleife nahtlos ist.
  • Endlose Bewegung ermüdet in einer Oberfläche: Ein dauerhaft pulsierendes Element konkurriert mit allem anderen auf der Seite um Aufmerksamkeit. Heben Sie es sich für echte Ladezustände auf.
  • Der Reduced-Motion-Block ist keine optionale Höflichkeit: Gleichgewichtsstörungen machen große oder wiederholte Bewegung wirklich unangenehm. Die Systemeinstellung zu beachten kostet drei Zeilen.

Keyframes and the shorthand are separate things

An animation is two pieces. The @keyframes block describes what changes. The animation shorthand on the element says how it runs — duration, timing function, delay, iteration count, direction, fill mode.

The shorthand is where most of the character comes from. The same keyframes at 200ms with an ease-out read as responsive; at 2s with a linear timing they read as decorative. The [msm_tool slug="css-animation"] gives you every part of it rather than only a duration.

Animate transform and opacity

This is the performance rule that actually matters, and it is short.

Changing transform or opacity can be handled by the compositor without recalculating layout or repainting. Changing width, height, top, left, margin or padding forces the browser to redo layout on every frame, for every element affected.

The practical translation:

  • Move things with transform: translate(), not top and left.
  • Resize with transform: scale(), not width and height.
  • Fade with opacity, not by changing a colour's alpha.
  • Rotate with transform: rotate(), which has no layout equivalent anyway.

An animation that stutters is almost always animating a layout property. Switching it to a transform usually fixes it outright.

Fill mode decides what happens at the end

By default an element snaps back to its unanimated state the moment the animation finishes. For a looping animation that is invisible. For a one-shot entrance it is the bug people report as "my animation runs and then everything jumps".

forwards holds the final keyframe, which is what an entrance almost always wants. backwards applies the first keyframe during any delay, which stops an element flashing at its natural position before the animation starts. both does each.

If you set a delay and see a flash before the movement begins, backwards is the fix.

Direction, and avoiding the jump

A looping animation whose last keyframe differs from its first will snap back each time round. alternate runs it forwards then backwards instead, so the loop is seamless without writing a return journey into the keyframes.

That halves the keyframe work for anything that pulses, breathes or sways, and it is why those effects usually need only two keyframes rather than three.

The easing applies between each pair of keyframes

Not across the whole sequence. This one catches people out.

Adding ease-in-out to a four-keyframe animation eases four separate times, producing a visible stutter at each keyframe rather than one smooth arc. If you want a single curve across the whole thing, use two keyframes and let the timing function do the shaping. If you genuinely need intermediate positions, consider linear between them so the steps do not fight each other.

Infinite motion is tiring

A permanently animating element competes with everything else on the page for attention, and it does not stop competing. Reserve infinite loops for genuine loading states, where the movement is telling the user something is happening.

A pulsing call-to-action button is the classic misuse. It draws the eye once and irritates thereafter, and on a page someone uses daily it becomes a reason to leave.

Reduced motion is not optional courtesy

Vestibular disorders make large or repeated motion genuinely unpleasant — nausea and dizziness rather than mild annoyance. Operating systems expose a setting for it, browsers pass it through, and honouring it costs three lines:

@media (prefers-reduced-motion: reduce) { .animated { animation: none; } }

The generated CSS includes that block. A more considered approach is to reduce rather than remove — keep a fade, drop the movement — since an interface with no transitions at all can be harder to follow. Either is better than ignoring the request.

Animation or transition

A transition runs between two states when something changes: a hover, a class being added, a value updating. It needs a trigger and it goes one way and back.

An animation runs on its own through keyframes, can loop, and can have as many intermediate steps as you like. If the movement has a start and an end tied to an interaction, it is a transition. If it runs by itself or needs more than two points, it is an animation.

Häufig gestellte Fragen

Speziell zum CSS-Keyframe-Animations-Generator. Allgemeinere Fragen zu dieser Kategorie werden auf der Kategorieseite beantwortet.

Der Standard-Füllmodus versetzt es in den unanimierten Zustand zurück. Setzen Sie forwards, um das letzte Keyframe zu halten.
Setzen Sie die Richtung auf alternate, sodass sie vorwärts und dann rückwärts läuft. Eine Schleife, deren Ende sich vom Anfang unterscheidet, springt sonst bei jedem Durchlauf.
Leserinnen können ihr System um weniger Bewegung bitten, oft weil ihnen Bewegung übel wird. Der Block beachtet das und kostet fast nichts.
transform und opacity. Beide vermeiden ein Neuberechnen des Layouts, während width, height, top oder left diese Arbeit in jedem Einzelbild erzwingen.
Eine transition läuft zwischen zwei Zuständen, wenn sich etwas ändert. Eine animation läuft von selbst durch Keyframes und kann in Schleife gehen.

Abonniere Benachrichtigungen zu neuen Tools, Funktionen und Produktivitätstipps.