dan

DanmakuKit

高性能弹幕框架 DanmakuKit is a high performance library that provides the basic functions of danmaku.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

98

Maintenance

Last Commit

13d ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

DanmakuKit

Version License Platform

Introduction

DanmakuKit is a high performance library that provides the basic functions of danmaku. It provides a set of processes that allow you to generate the danmaku cell via cellModel, and each danmaku can be drawn either synchronously or asynchronously.

中文博客

As shown in the GIF below, DanmakuKit offers three types of danmaku launch: floating, top and bottom.

Demo_0

Demo_1

Supported features

  • Speed adjustment
  • Track height adjustment
  • Display area adjustment
  • Click callback
  • Support to pause or play a single danmaku
  • Provides property to specify whether danmaku can overlap
  • Support to disable danmaku for different types of tracks
  • Support for setting progress property to render the danmaku immediately on the view
  • Support to clear all danmaku
  • Support playing speed
  • Support GIF Danmaku

TODO

If you have any requirements that you want DanmakuKit to provide, you can raise issue.

Example

For detailed usage, see the Example project, which provides a functional demonstration and an example of using it with a player.

Use Guide

  1. Implement a model to inherit from the DanmakuCellModel. In this model you need to add your own properties and methods to draw the danmaku.
  2. Implement a View inherited from DanmakuCell. Override the willDisplay method to prepare a thread-safe model for drawing a danmaku. Then you need to override the displaying method, and use CGContext draw your danmaku. It is important to note when call displaying method was not in the main thread, so you need to consider multithreading. And finally, if you also need to do something at the end of the drawing, you can override the didDisplay method to do that.
  3. Pass the DanmakuCellModel to the DanmakuView so that it will fire the danmaku for you.

If you want to display GIF on a danmaku, then import the Gif subspec and use the DanmakuGifCell and DanmakuGifCellModel.

Requirements

swift 5.0+

iOS 9.0+

Installation

DanmakuKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DanmakuKit', '~> 1.3.0'

License

DanmakuKit is available under the MIT license. See the LICENSE file for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100