Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
frame-animation
Advanced tools
通常我们会遇到一些需求,用js实现一组动画(这里指的是由一帧帧图片组合而成的动画,非jq的animate)。
其实原理很简单,如果是多张图,就定时去改变image的src,如果是一张图,就定时改变backgroud-position;同时,我们还要支持图片预加载,动画执行次数(一次,n次,无限次),动画暂停,动画执行完成的回调等等。
有了上述需求,我觉得写一个通用的animation库还是很有必要的,这样用户就每必要为每一组动画写逻辑了,从繁琐的劳动中解放,不正是每个coder所期望的么:)
$ npm install frame-animation
<div id="demo"></div>
#demo {
width: 100px;
height: 100px;
background: url('foo.png');
}
var animation = require("frame-animation");
var ele = document.getElementById('demo');
var frameMap = ['0 0', '0 -100', '0 -200'];
var demoAnimation = animation().changePosition(ele, positions).repeat();
demoAnimation.start(200);
这种链式调用的语法,是不是很爽呢(妈妈再也不用担心我的动画)
animation的源码是基于webpack构建的
首先,clone项目源码
git clone https://github.com/ustbhuangyi/animation.git
安装依赖
cd animation
npm install
测试demo页
npm run dev
打开浏览器访问如下地址, 查看效果
localhost:9090
FAQs
a common animation lib
We found that frame-animation 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 removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.