
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
mot-plugin-apng
Advanced tools
该插件可以单独使用也可搭配 mot 库使用 需要浏览器支持以下四种能力
import APNG from "mot-plugin-apng";
let apng = new APNG();
正在开发 💦
用途:浏览器是否支持 apng
参数:无
返回:promise
apng
.isSupport()
.then(() => {
console.log("not support");
})
.catch(() => {
console.log("support");
});
用途:将 apng 解析成 canvas 提供控制器
img :HTMLImgElement 需要解析的 img dom 元素autoplay :boolean 是否自动播放independent :boolean 是否需要独立控制器 >> 当检测到相同 url 地址时 为了性能 默认会共用一个控制器增加 canvas 上下文,当设置为 true 是 会为当前项独立新增一个控制器返回:promise anim
var image1 = document.querySelector(".apng-image1");
apng.animateImage(image1, false).then((anim) => {
anim.play([50, 70]);
anim.before((ctx, f) => {
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 100 + f * 3, 100 + f * 3);
});
anim.after((ctx, f) => {
ctx.fillStyle = "blue";
ctx.fillRect(200, 200, 100 + f * 3, 100 + f * 3);
});
});
| 参数名 | 数据类型 | 用途 |
|---|---|---|
| width | number | 当前 canvas 宽度 px |
| height | number | 当前 canvas 高度 px |
用途:控制播放
frameArray: [start,end]数组 表示播放的帧数范围,只有 start 的时候播放至结尾用途:停止播放
用途:清除内容
用途:搭配 pause 暂停使用,重新开始播放
用途:暂停播放
frame:当 frame 存在时,到达 frame 帧数时暂停播放用途:设置选项
| 参数名 | 数据类型 | 用途 | 默认值 |
|---|---|---|---|
| playNum | number | 播放次数 | 0:表示循环播放 |
| rate | number | 播放速率 | 1 |
用途:表示在 apng 之前渲染
func: 要执行的函数 暴露两个参数 context:canvas 上下文 f:当前帧数用途:表示在 apng 之后渲染
func: 要执行的函数 暴露两个参数 context:canvas 上下文 f:当前帧数用途:状态监听
| 参数名 | 数据类型 | 用途 | 默认值 |
|---|---|---|---|
| hook | string | 监听的状态 目前只开放了'stop','allStop' | |
| callback | function | 回调函数 stop 时触发回调 |
用途:一次性状态监听
| 参数名 | 数据类型 | 用途 | 默认值 |
|---|---|---|---|
| hook | string | 监听的状态 目前只开放了'stop','allStop' | |
| callback | function | 回调函数 stop 时触发回调 |
FAQs
该插件可以单独使用也可搭配 mot 库使用 需要浏览器支持以下四种能力
We found that mot-plugin-apng 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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.