
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
mfuns-location-danmaku
Advanced tools
下载 lib/mfunsLocationDanmaku.js 文件,使用 script 标记导入到 html 中
npm i mfuns-location-danmaku
导入方式
import { MfunsLocationDanmaku } from "mfuns-location-danmaku";
实例化
let advancedDanmaku = new MfunsLocationDanmaku(
container: document.getElementById("advanced-danmaku"),
// 拉取弹幕列表
getDanmaku: () => {
return ([{...}, {...}])
},
// 舞台基本尺寸, 可选
stageSize: [1920, 1080]
);
播放
暂停
time:number)跳转到指定位置(单位ms)
获取弹幕引擎的播放时间,单位为ms
在不重置时间的情况下清空并重新加载弹幕
重置弹幕引擎并重新加载弹幕
添加一条弹幕到时间轴,适用于新增实时弹幕
播放一条弹幕,即直接添加一条弹幕到舞台,适用于弹幕编辑效果预览
根据舞台容器的尺寸调整舞台大小
当浏览器窗口大小变化时,会自动调用resize()方法调整舞台大小
[
{
"id": 0, // 弹幕唯一标识id, 可选, 接受数字/字符串格式
"text": "{...}", // 定位弹幕JSON字符串
"time": 0 // 弹幕发送位置, 可选, 弹幕内容无发送时间设置时将使用该属性替代
},
...
]
{
"content": "", // 弹幕内容
"size": 25, // 弹幕字号
"color": 16777215, // 弹幕颜色(Hex字符串/Hex转十进制)
"bold": false, // 粗体
"font": "SimHei", // 字体
"shadow": [16777215, 0, 0, 0], // 阴影(可选) [颜色, x, y, 模糊]
"stroke": [16777215, 1], // 描边(可选) [颜色, 描边宽度]
"start": 0, // 弹幕开始时间
"zIndex": 50, // 弹幕层级
"anchor": [0, 0], // 锚点
"relative": 800, // 相对宽度
"duration": 1000, // 存活时间
"location": [0, 0], // 位置 [x, y]
"rotation": [0, 0, 0],// 角度 [x, y, z] (可选, 若不选则不做变换)
"scale": [0, 0], // 大小 [x, y] (可选, 若不选则不做变换)
"animations": [ // 动画
{
"duration": 1000, // 运动时间
"location": [0, 0], // 位置 [x, y] (与舞台宽高的比值)
"rotation": [0, 0, 0],// 角度 [x, y, z] (可选, 若不选则不做变换)
"scale": [1, 1], // 大小 [x, y] (可选, 若不选则不做变换)
"ease": 0 // 速度曲线 (0=线性 1=加速 2=减速 3=缓入缓出)
}
]
}
FAQs
Mfuns定位弹幕引擎
The npm package mfuns-location-danmaku receives a total of 0 weekly downloads. As such, mfuns-location-danmaku popularity was classified as not popular.
We found that mfuns-location-danmaku demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.