File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ # 推荐使用方法 Recommended Implementations
2+
3+ ### 弹幕速度 Comment Default Speed
4+ 调整弹幕速度无需更改代码。相比之下我们更推荐使用 ` CommentManager.options ` 下调整。相关参数是:
5+
6+ - ` options.global.scale ` 全局生存时间加成
7+ - ` options.scroll.scale ` 滚动弹幕生存时间加成
8+
9+ 默认的弹幕生存时间是 ` 4.000s ` ,加成参数叠加使用,比如如果 ` global.scale = a ` ,` scroll.scale = b `
10+ 那么一条滚动弹幕(滚动,底部滚动,逆向)的总生存时间就是 ` 4 * a * b ` ,而固定弹幕(顶部,底部)的
11+ 生存时间则是 ` 4 * a ` 。
12+
13+ 加成数值越大, ** 弹幕运行速度越低** 。不过值得注意的是,每条弹幕的“速度”是不一样的,根据弹幕的长度
14+ 决定。这里的加成数值只改变弹幕的“生存时间“。
15+
16+ 注意:改变全局加成会改变包括高级弹幕在内的所有弹幕的生存时间。请确认你真的希望这样做才更改` global ` 。
17+
18+ ### 弹幕字号(和速度)同步拉伸 Autoscale Comment
19+ 如果希望实现弹幕的速度和字号同步拉伸的话,比起更改每条弹幕,我们更加推荐直接拉伸弹幕舞台/“容器”。
20+ 注意的步骤如下:
21+ - ** 不要** 更改弹幕速度的加成数值,弹幕大了自然速度就慢了,没必要继续降低速度。
22+ - 首先,确定默认的容器大小,这个大小为弹幕字号 1:1 的大小。
23+ - 注意更新 setBounds让等比放大的弹幕容器还能继续填满视频
24+
25+ 实现的伪代码如下:
26+
27+ ``` JavaScript
28+ var container = document .getElementById (" container" );
29+ var width = WIDTH , height = HEIGHT ;
30+
31+ // 计算缩放比例,只看宽度
32+ var scale = container .offsetWidth / WIDTH ;
33+
34+ // 计算高度差,更新银幕
35+ var expHeight = (container .offsetHeight / scale);
36+ cm .setBounds (width, expHeight); // 更新空间管理器的大小
37+
38+ // 用 CSS 来拉伸银幕
39+ container .style .transform = " scale(" + scale + " )" ;
40+ ```
41+
42+ ### 弹幕透明度 Opacity
43+ 弹幕透明度有两个设置方法,位于
44+
45+ - ` options.global.opacity ` 全局透明度上限
46+ - ` options.scroll.opacity ` 滚动弹幕透明度上限
47+
48+ 一般情况下,允许用户更改的透明度上限应该是滚动弹幕上限。更改全局上限的话可能引发弹幕字符画的不利显示。
49+ 注意:虽然在设置里叫opacity其实这个是对应弹幕的 alpha 字段。
50+
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ CCL包括一套尽可能完备的文档来帮助二次开发。文档主要针
99- [ CommentManager 弹幕管理器] ( CommentManager.md )
1010- [ CommentObject 弹幕对象] ( CommentObject.md )
1111
12+ ### 使用方法参考(Customization)
13+ 理论上CCL兼容的功能非常之多,但是并不是所有的功能都在库中有实现,有关实现一些效果的较好的做法,请参考
14+ [ DoingItRight 推荐使用方法] ( DoingItRight.md )
15+
1216## 如何架设(How to Deploy)
1317CommentCoreLibrary主要包括两个部分,CommentCore主体和KagerouEngine代码弹幕支持引擎。
1418
File renamed without changes.
You can’t perform that action at this time.
0 commit comments