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
- Initializing VAP player (Android):
val vapView = findViewById<VapView>(R.id.vap_view)
vapView.setVideoPath("path/to/your/video.mp4")
vapView.start()
- 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
}
})
- 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:
-
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'
- For Android (in
-
Initialize and use the VAP player in your code as shown in the examples above.
-
Prepare your video animations in the required format (MP4 with alpha channel) using the VAP encoding tools provided in the repository.
-
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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
VAP
ç®ä½ä¸æ | English
VAPï¼Video Animation Playerï¼æ¯ä¼é¹ çµç«å¼åï¼ç¨äºææ¾é ·ç«å¨ç»çå®ç°æ¹æ¡ã
- ç¸æ¯Webp, Apngå¨å¾æ¹æ¡ï¼å ·æé«å缩ç(ç´ ææ´å°)ã硬件解ç (解ç æ´å¿«)çä¼ç¹
- ç¸æ¯Lottieï¼è½å®ç°æ´å¤æçå¨ç»ææ(æ¯å¦ç²åç¹æ)
项ç®è¯¦ç»ä»ç»è¯·åè Introduction.md
ç¹æå±ç¤ºï¼
èä¸VAPè¿è½å¨å¨ç»ä¸èå ¥èªå®ä¹çå±æ§ï¼æ¯å¦ç¨æ·å称, 头åï¼
æ§è½ç®è¿°
- | æä»¶å¤§å° | 解ç æ¹å¼ | ç¹ææ¯æ |
---|---|---|---|
Lottie | æ æ³å¯¼åº | 软解 | æ ç²åç¹æ |
GIF | 4.6M | 软解 | åªæ¯æ8ä½è²å½© |
Apng | 10.6M | 软解 | å ¨æ¯æ |
Webp | 9.2M | 软解 | å ¨æ¯æ |
mp4 | 1.5M | 硬解 | æ éæèæ¯ |
VAP | 1.5M | 硬解 | å ¨æ¯æ |
å®éªåæ°åè Introduction.md
å¹³å°æ¯æ
æ¯æï¼Android, iOS, web. æ¥å ¥è¯´æå¨å¯¹åºå¹³å°ç®å½ä¸
ç´ æå¶ä½å·¥å ·ï¼VapTool (å·¥å ·ä½¿ç¨è¯´æå¨toolç®å½ä¸)
ææ¾é¢è§å·¥å ·ï¼Mac, Windows
å·²æ¥å ¥APP
FAQ
License
VAP is under the MIT license. See the LICENSE file for details.
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) 动画。
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot