Convert Figma logo to code with AI

Tencent logovap

VAP是企鹅电竞开发,用于播放特效动画的实现方案。具有高压缩率、硬件解码等优点。同时支持 iOS,Android,Web 平台。

3,899
522
3,899
89

Top Related Projects

An iOS library to natively render After Effects vector animations

Load and get full control of your Rive files in a Flutter project using this library.

Flutter runtime for Rive

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。

Quick Overview

VAP (Video Animation Player) is an open-source library developed by Tencent for efficient playback of alpha channel video animations on mobile devices. It supports both iOS and Android platforms, providing a lightweight solution for integrating high-quality video animations with transparency into mobile applications.

Pros

  • Cross-platform support for iOS and Android
  • Efficient playback of alpha channel videos with low resource consumption
  • High-quality animation rendering with transparency
  • Easy integration into existing mobile applications

Cons

  • Limited documentation, especially for advanced usage
  • Primarily focused on mobile platforms, lacking support for web or desktop applications
  • May require additional setup for complex animations or custom effects
  • Dependency on specific video encoding formats for optimal performance

Code Examples

  1. Initializing VAP player (Android):
val vapView = findViewById<VapView>(R.id.vap_view)
vapView.setVideoPath("path/to/your/video.mp4")
vapView.start()
  1. Adding click listener to VAP view (Android):
vapView.setAnimationListener(object : AnimationListener {
    override fun onVideoStart() {
        // Video started playing
    }

    override fun onVideoEnd() {
        // Video finished playing
    }

    override fun onVideoError(error: Int) {
        // Error occurred during playback
    }
})
  1. Creating VAP player (iOS):
let vapView = VAPView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
vapView.loadVapx("path/to/your/video.mp4", completion: { result in
    if result {
        vapView.play()
    }
})

Getting Started

To use VAP in your project:

  1. Add the VAP dependency to your project:

    • For Android (in build.gradle):
      implementation 'com.tencent.vap:vap:2.0.19'
      
    • For iOS (in Podfile):
      pod 'VAP'
      
  2. Initialize and use the VAP player in your code as shown in the examples above.

  3. Prepare your video animations in the required format (MP4 with alpha channel) using the VAP encoding tools provided in the repository.

  4. Refer to the project's documentation for more detailed integration instructions and advanced usage.

Competitor Comparisons

An iOS library to natively render After Effects vector animations

Pros of lottie-ios

  • Supports a wide range of animation types and effects
  • Extensive documentation and community support
  • Seamless integration with Adobe After Effects

Cons of lottie-ios

  • Larger file sizes for complex animations
  • Limited support for video-based animations
  • May require more processing power for intricate animations

Code Comparison

lottie-ios:

let animationView = AnimationView(name: "animation")
animationView.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
animationView.contentMode = .scaleAspectFit
animationView.loopMode = .loop
animationView.play()

vap:

let player = VAPView()
player.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
player.contentMode = .scaleAspectFit
player.loop = true
player.play(with: URL(string: "https://example.com/animation.mp4"))

Both libraries offer easy-to-use APIs for playing animations, but vap focuses on video-based animations, while lottie-ios supports a broader range of animation types. lottie-ios provides more customization options and integration with design tools, whereas vap excels in efficient video playback and smaller file sizes for video-based animations.

Load and get full control of your Rive files in a Flutter project using this library.

Pros of Flare-Flutter

  • Cross-platform support for Flutter, allowing animations to run on multiple devices
  • Tight integration with Flutter's widget system for seamless UI incorporation
  • Smaller file sizes for animations compared to traditional video formats

Cons of Flare-Flutter

  • Limited to 2D vector animations, while vap supports video-based animations
  • Requires learning a specific animation tool (Flare) for content creation
  • May have performance limitations for complex animations on lower-end devices

Code Comparison

Flare-Flutter:

FlareActor(
  "assets/animation.flr",
  animation: "idle",
  fit: BoxFit.contain,
)

vap:

let vapView = VAPView()
vapView.play(with: URL(fileURLWithPath: "path/to/video.mp4"))

The Flare-Flutter code snippet demonstrates how to easily integrate a Flare animation into a Flutter widget, while the vap code shows how to play a video animation using the VAPView. Flare-Flutter's approach is more declarative and fits well within Flutter's widget tree, whereas vap's implementation is more imperative and focused on video playback.

Flutter runtime for Rive

Pros of rive-flutter

  • Supports complex animations with interactive elements and state machines
  • Offers a more comprehensive animation ecosystem with design tools and runtime libraries
  • Provides better performance for vector animations and smaller file sizes

Cons of rive-flutter

  • Steeper learning curve due to its more complex animation system
  • Limited to vector-based animations, not suitable for video-like content
  • Requires using the Rive editor for creating animations

Code comparison

rive-flutter:

final riveFile = await RiveFile.asset('assets/animation.riv');
final artboard = riveFile.mainArtboard;
artboard.addController(SimpleAnimation('idle'));

vap:

VAPView *vapView = [[VAPView alloc] init];
[vapView playWithUrl:@"https://example.com/animation.mp4"];
[self.view addSubview:vapView];

Summary

rive-flutter is better suited for complex, interactive vector animations with smaller file sizes, while vap is more appropriate for simple video-like animations. rive-flutter offers a more comprehensive ecosystem but has a steeper learning curve, whereas vap is simpler to use but less flexible. The choice between the two depends on the specific animation requirements and the desired level of interactivity and complexity.

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。

Pros of SVGAPlayer-Android

  • Supports vector animations, resulting in smaller file sizes and better scalability
  • Provides a more extensive API for controlling animations and handling events
  • Offers better cross-platform compatibility (iOS, Android, Web)

Cons of SVGAPlayer-Android

  • Limited to 2D animations, while VAP supports both 2D and 3D effects
  • May have higher CPU usage for complex animations compared to VAP
  • Lacks built-in support for audio synchronization, which VAP provides

Code Comparison

SVGAPlayer-Android:

val player = SVGAImageView(context)
val parser = SVGAParser(context)
parser.decodeFromAssets("animation.svga", object : SVGAParser.ParseCompletion {
    override fun onComplete(videoItem: SVGAVideoEntity) {
        player.setVideoItem(videoItem)
        player.startAnimation()
    }
})

VAP:

val animView = AnimView(context)
animView.setVideoPath("animation.mp4")
animView.setListener(object : IAnimListener {
    override fun onVideoStart() {
        // Animation started
    }
    override fun onVideoComplete() {
        // Animation completed
    }
})
animView.startPlay()

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

VAP

License

简体中文 | English

VAP(Video Animation Player)是企鹅电竞开发,用于播放酷炫动画的实现方案。

  • 相比Webp, Apng动图方案,具有高压缩率(素材更小)、硬件解码(解码更快)的优点
  • 相比Lottie,能实现更复杂的动画效果(比如粒子特效)

项目详细介绍请参考 Introduction.md

特效展示:

展示主页

而且VAP还能在动画中融入自定义的属性(比如用户名称, 头像)

性能简述

-文件大小解码方式特效支持
Lottie无法导出软解无粒子特效
GIF4.6M软解只支持8位色彩
Apng10.6M软解全支持
Webp9.2M软解全支持
mp41.5M硬解无透明背景
VAP1.5M硬解全支持

实验参数参考 Introduction.md

平台支持

支持:Android, iOS, web. 接入说明在对应平台目录中

素材制作工具:VapTool (工具使用说明在tool目录下)

播放预览工具:Mac, Windows

已接入APP

app

FAQ

常见问题解答

License

VAP is under the MIT license. See the LICENSE file for details.