jabbany / CommentCoreLibrary

Javascript Live Comment (Danmaku) Engine Implementation. JS弹幕模块核心,提供从基本骨架到高级弹幕的支持。
http://jabbany.github.io/CommentCoreLibrary/demo
MIT License
1.9k stars 304 forks source link

请问一下定位弹幕里的motion这个参数值如何设定啊?查看文档并没有给出样例。 #105

Closed niu0717 closed 5 years ago

niu0717 commented 5 years ago

文档中说motion跟着的格式是数组形式的IMotion, 但这个IMotion的格式具体是啥样的呢?

niu0717 commented 5 years ago

比如Mode7时,使用send方法移动一段距离,比如从左上移到右下,(直接设置,x,y,toX,toY没有生效),那么使用motion该怎么设置呢?

jabbany commented 5 years ago

相关文档在这里

每个关键帧对象是一个Object,可以有一系列属性(如 x, y, alpha 等等)。每个 属性由一个 Object 表示

例子:

{
    "motion": [
        {
            "x": { "from": 0, "to": 100, "dur": 2000, "delay": 0},
            "y": { "from": 100, "to": 0, "dur": 1000, "delay": 500},
        },
        {
            "size": { "from": 25, "to": 50, "dur": 1000, "delay": 0}
        }
    ]
}

例子表示的动画操作:

niu0717 commented 5 years ago

好的,谢谢