gitmyhub

libpag

C++ ★ 5.7k updated 2d ago

The official rendering library for PAG (Portable Animated Graphics) files that renders After Effects animations natively across multiple platforms.

libpag is a library from Tencent for playing back animations that were created in Adobe After Effects. Instead of converting animations to video files, designers export them as PAG files using a plugin, and libpag renders those files in real time inside an app. The result is a compact, scalable animation that can be modified at runtime, unlike a pre-rendered video.

The PAG file format is designed to preserve all After Effects features, including effects from third-party plugins, vector shapes, and raster layers. The files are stored in a binary format that decodes about ten times faster than the JSON-based formats used by some other animation tools, and they tend to be roughly half the size for equivalent content. A desktop viewer app called PAGViewer lets designers preview their animations and check performance metrics before handing files off to developers.

The library runs on iOS, Android, macOS, Windows, Linux, Harmony OS, and the web. Tencent uses it in its own major apps, including WeChat and QQ. Developers integrate it using standard package managers: CocoaPods for iOS, Maven for Android, OHPM for HarmonyOS, and a JavaScript bundle for web projects. Once integrated, the SDK provides APIs to swap out text or images inside an animation at runtime, combine multiple PAG files, and modify layer properties without redesigning the original After Effects file.

Building the library from source requires a fairly involved toolchain including CMake, Ninja, and platform-specific compilers. Tencent publishes precompiled binaries for most platforms through their release page, so most developers will not need to build from source.

The project is open source under the Apache 2.0 license. The full README is longer than what was shown.