Formate
Unterstützte Formate & Wiedergabebibliotheken
Wähle deine Plattform unter jedem Format — die Bibliotheksnamen verlinken auf die offiziellen Repositories.
SVGA
.svgaEin kompaktes Animationsformat, direkt aus After Effects exportiert und weit verbreitet für Live-Streaming-Geschenke. Wird über die SVGAPlayer-Familie hardwarebeschleunigt abgespielt.
val parser = SVGAParser(context)
parser.decodeFromURL(URL(itemUrl)) { videoItem ->
svgaImageView.setVideoItem(videoItem)
svgaImageView.startAnimation()
}
let player = SVGAPlayer(frame: view.bounds)
SVGAParser().parse(with: URL(string: itemUrl)!) { entity in
player.videoItem = entity
player.startAnimation()
}
import SVGA from "svgaplayerweb";
const player = new SVGA.Player("#canvas");
new SVGA.Parser().load(itemUrl, (videoItem) => {
player.setVideoItem(videoItem);
player.startAnimation();
});
SVGASimpleImage(resUrl: itemUrl);
WebP
.webpAnimierte WebP-Bilder mit voller Alpha-Transparenz in einer einzigen kleinen Datei. Auf den meisten Plattformen nativ unterstützt — kaum bis keine zusätzliche Laufzeit nötig.
// Animated WebP plays out of the box
Glide.with(context).load(itemUrl).into(imageView)
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
imageView.sd_setImage(with: URL(string: itemUrl))
<!-- Animated WebP is supported natively -->
<img src="item.webp" alt="" />
// Animated WebP is supported natively
Image.network(itemUrl);
VAP
.mp4Tencents Video-Animation-Player-Format: ein MP4 mit einer Farbspur plus einer Alpha-Spur und einer vapc-Konfigurationsbox, für pixelgenaues Compositing aufwendiger Geschenkeffekte.
// AnimView from the VAP SDK
animView.setLoop(1)
animView.startPlay(File(itemPath))
// QGVAPWrapView from the VAP SDK
[wrapView playHWDMP4:itemPath repeatCount:0 delegate:self];
import Vap from "video-animation-player";
new Vap({ container, src: itemUrl, config: vapcJson }).play();
VapView();
await VapController.playPath(itemPath);
MP4 Alpha
.mp4Ein reguläres MP4, dessen Frame die Farbhälfte neben einer Graustufen-Alpha-Hälfte enthält. Dein Player tastet beide Hälften ab und setzt eine vollständig transparente Animation zusammen.
// Side-by-side color/alpha video
alphaMovieView.setVideoFromUrl(itemUrl)
alphaMovieView.start()
BDAlphaPlayerMetalConfiguration *config =
[BDAlphaPlayerMetalConfiguration defaultConfiguration];
config.directory = itemDirectory;
[self.playerView playWithMetalConfiguration:config];
// Upload each <video> frame as a texture, then in the
// fragment shader: rgb from the color half x alpha from
// the alpha half -> draw on a transparent canvas.
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,
gl.UNSIGNED_BYTE, video);
// Play the mp4, sample color/alpha halves in a
// custom FragmentShader and paint the composited frame.
final controller = VideoPlayerController.networkUrl(Uri.parse(itemUrl));
await controller.initialize();
controller.play();
PAG
.pagTencents PAG (Portable Animated Graphics): After-Effects-Animationen in einer winzigen Binärdatei, gerendert von der plattformübergreifenden libpag-Laufzeit (WASM im Web).
val pagView = PAGView(context)
pagView.composition = PAGFile.Load(itemPath)
pagView.setRepeatCount(0)
pagView.play()
let pagView = PAGView()
pagView.setComposition(PAGFile.load(itemPath))
pagView.setRepeatCount(0)
pagView.play()
import { PAGInit } from "libpag";
const PAG = await PAGInit();
const file = await PAG.PAGFile.load(buffer);
const view = await PAG.PAGView.init(file, canvas);
view.setRepeatCount(0);
await view.play();
PAGView.network(
itemUrl,
repeatCount: PAGView.REPEAT_COUNT_LOOP,
autoPlay: true,
);
Lottie
.json / .lottieAirbnbs Lottie: After-Effects-Animationen, exportiert als JSON (oder ein .lottie-dotLottie-Bundle) und auf jeder Plattform nativ gerendert.
lottieView.setAnimationFromUrl(itemUrl)
lottieView.repeatCount = LottieDrawable.INFINITE
lottieView.playAnimation()
let view = LottieAnimationView(url: URL(string: itemUrl)!) { _ in }
view.loopMode = .loop
view.play()
import lottie from "lottie-web";
lottie.loadAnimation({
container,
path: itemUrl,
renderer: "svg",
loop: true,
autoplay: true,
});
APNG
.pngAnimiertes PNG — das Standard-PNG-Format mit einem Animationssteuerungs-Chunk, das verlustfreie Qualität und volle Alpha-Transparenz behält. Statische PNG-Dateien werden vom Marktplatz abgelehnt.
val drawable = APNGDrawable.fromFile(itemPath)
imageView.setImageDrawable(drawable)
// APNG plays out of the box
imageView.sd_setImage(with: URL(string: itemUrl))
<!-- APNG is supported natively -->
<img src="item.png" alt="" />
// APNG is supported natively
Image.network(itemUrl);