一体式
动画
引擎.
一个快速且多功能的 JavaScript
库,可用于动画化网页.
npm i animejs
赞助商
一个快速且多功能的 JavaScript
库,可用于动画化网页.
npm i animejs
摆脱浏览器限制,使用单一 API 即可为网页上的任何内容制作动画。
通过多功能的合成 API,平滑地混合各个 CSS 变换属性。
只导入所需部分,以保持包大小小巧。
animate('.square', {
rotate: 90,
loop: true,
ease: 'inOutExpo',
});
animate('.shape', {
x: random(-100, 100),
y: random(-100, 100),
rotate: random(-180, 180),
duration: random(500, 1000),
composition: 'blend',
});
animate('.car', {
...createMotionPath('.circuit'),
});
animate(createDrawable('.circuit'), {
draw: '0 1',
});
animate('.circuit-a', {
d: morphTo('.circuit-b'),
});
animate(createDrawable('path'), {
draw: ['0 0', '0 1', '1 1'],
delay: stagger(40),
ease: 'inOut(3)',
autoplay: onScroll({ sync: true }),
});
const options = {
grid: [13, 13],
from: 'center',
};
createTimeline()
.add('.dot', {
scale: stagger([1.1, .75], options),
ease: 'inOutQuad',
}, stagger(200, options));
createDraggable('.circle', {
releaseEase: createSpring({
stiffness: 120,
damping: 6,
})
});
createTimeline()
.add('.tick', {
y: '-=6',
duration: 50,
}, stagger(10))
.add('.ticker', {
rotate: 360,
duration: 1920,
}, '<');
createScope({
mediaQueries: {
portrait: '(orientation: portrait)',
}
})
.add(({ matches }) => {
const isPortrait = matches.portrait;
createTimeline().add('.circle', {
y: isPortrait ? 0 : [-50, 50, -50],
x: isPortrait ? [-50, 50, -50] : 0,
}, stagger(100));
});