All Projects → hidaron → Hiframeanimation

hidaron / Hiframeanimation

低内存消耗的序列帧动画库,只占用一张序列帧图片的内存,可用于直播大礼物的展示

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Hiframeanimation

Android P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 70 (-42.62%)
Mutual labels:  live
Xzs
学之思在线考试系统 - postgresql版,支持多种题型:选择题、多选题、判断题、填空题、解答题以及数学公式,包含PC端、小程序端,扩展性强,部署方便(集成部署、前后端分离部署、docker部署)、界面设计友好、代码结构清晰
Stars: ✭ 1,320 (+981.97%)
Mutual labels:  live
Clsync
file live sync daemon based on inotify/kqueue/bsm (Linux, FreeBSD), written in GNU C
Stars: ✭ 115 (-5.74%)
Mutual labels:  live
Abr Broadcaster
A real time encoder for Adaptive Bitrate Broadcast
Stars: ✭ 80 (-34.43%)
Mutual labels:  live
Kodeweave
HTML/CSS/JS and Markdown Playground For Web Designers and Developers
Stars: ✭ 87 (-28.69%)
Mutual labels:  live
Awesome Livecoding
All things livecoding
Stars: ✭ 1,373 (+1025.41%)
Mutual labels:  live
Hugit
The humane Terminal UI for git!
Stars: ✭ 49 (-59.84%)
Mutual labels:  live
Vue Live
A component to demo components, inspired by react-live
Stars: ✭ 123 (+0.82%)
Mutual labels:  live
Livesourcecode
严振杰直播所有完整代码收集。
Stars: ✭ 90 (-26.23%)
Mutual labels:  live
Aesthetics
Image Aesthetics Toolkit - includes Fisher Vector implementation, AVA (Image Aesthetic Visual Analysis) dataset and fast multi-threaded downloader
Stars: ✭ 113 (-7.38%)
Mutual labels:  live
Binari
Interactive code editor with a live binary tree visual designed to teach new developers the fundamentals of dynamic programming.
Stars: ✭ 82 (-32.79%)
Mutual labels:  live
Live Dl
Download live streams from YouTube
Stars: ✭ 82 (-32.79%)
Mutual labels:  live
Bilibili Vtuber Danmaku
Vtuber直播间的弹幕哟~
Stars: ✭ 107 (-12.3%)
Mutual labels:  live
Danmaku
live video comments protocol and platform api
Stars: ✭ 70 (-42.62%)
Mutual labels:  live
Iptv
Android project for live streaming IPTV
Stars: ✭ 120 (-1.64%)
Mutual labels:  live
Bilibili Live Recorder
下载 bilibili 直播 视频流
Stars: ✭ 52 (-57.38%)
Mutual labels:  live
Checklist Going Live
The checklist that is used when a project is going live
Stars: ✭ 1,334 (+993.44%)
Mutual labels:  live
Giftanim
直播礼物动画 送赞送礼物动画 仿映客礼物动画侧栏弹出送花人和礼物以及x1 x2 x3效果,支持队列 排序
Stars: ✭ 123 (+0.82%)
Mutual labels:  live
Watermonitor
Easy way to implement a Video Monitor use Android's AccessbilityService
Stars: ✭ 120 (-1.64%)
Mutual labels:  live
Livehd
Live Hardware Development (LiveHD), a productive infrastructure for Synthesis and Simulation
Stars: ✭ 110 (-9.84%)
Mutual labels:  live

HiFrameAnimation

低内存消耗的序列帧库,只占用了一张序列帧图片的内存,异步绘制不占用UI线程资源,同时复用序列帧Bitmap,减少内存抖动,避免了频繁的GC,提高动画的流畅性。可用于直播大礼物的展示。

image

使用了inBitmap复用内存

为了节省内存,我在每一帧绘制前才从本地读取并且编码图片,绘制完成后就释放,但这样的话会频繁地进行IO操作,造成内存抖动。为了减少内存抖动,我使用了inBitmap来复用当前帧所占用内存,效果还是很不错,内存抖动明显减缓了。

没有使用inBitmap image

使用inBitmap image

怎么使用

1.添加帧动画视图布局

 <org.limlee.hiframeanimationlib.FrameAnimationView
        android:id="@+id/frame_animation"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

2.添加序列帧资源

 List<FrameDrawable> frameDrawables = new ArrayList<>();
 for (String framePath : frameList) {
 	FrameDrawable frameDrawable = new FrameDrawable(FRAME_NAME + "/" + framePath, 100);
 	frameDrawables.add(frameDrawable);
 }
 mFrameAnimationView.addFrameDrawable(frameDrawables);

3.播放帧动画

 @Override
 protected void onPostCreate(@Nullable Bundle savedInstanceState) {
 	....
 	mFrameAnimationView.setOneShot(false); //循环播放帧动画
 	mFrameAnimationView.setOnFrameListener(new FrameAnimationView.OnFrameListener() { //添加监听器
                @Override
                public void onFrameStart() {
                    Log.d(TAG, "帧动画播放开始!");
                }

                @Override
                public void onFrameEnd() {
                    Log.d(TAG, "帧动画播放结束!");
                }
            });
 	mFrameAnimationView.start(); //开始播放
 }

4.停止播放

 @Override
 protected void onDestroy() {
 	super.onDestroy();
 	mFrameAnimationView.stop(); //停止播放
 	mFrameAnimationView.setOnFrameListener(null); //移除监听器
 }

最后,还可以使用属性动画来实现负责的大礼物动画

https://github.com/hidaron/CoreAnimator2Android

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].