![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@ntbl/animation
Advanced tools
animation,一个基于 anime.js 的动画库,更加便捷与实用。
npm i @ntbl/animation --save
import animation from '@ntbl/animation'
animation 是对 anime.js 的二次包装,内置了一些便捷实用的动画类型、并支持动画联动、正反播放切换和隐藏 dom。关于 animation 的基础使用,请参考 anime.js
本文档,只会涉及到 animation 自己封装和设计的概念与功能。它用起来狠是简单。
animation 提供了以下动画类型:
通过 type
属性指定需要使用的动画即可。
animation({
targets: '#box',
type: 'sideLeft'
})
另外,不同类型的动画还可以配合使用。(不同类型指的是 sideTop 和 fadeIn 是不同类型的,而 sideTop 和 sideLeft 是同类型)
animation({
targets: '#box',
type: ['sideLeft', 'fadeIn']
})
anime.js 实例的 seek()
方法,可用于精确控制动画进行,比如配合手势库,可以实现原生应用上抽屉导航与手指在同步屏幕上移动。参考
anime.js 可以使用 timeline
实现时间轴动画,在此基础上 animation 简化和统一了用法,增加了联动。联动顾名思义就是同时进行二个或多个动画,并且可以配合动画控制,做出和原生应用一致的动画体验。
默认情况下,timeline 是按照动画先后顺序执行(即所谓时间轴动画),在 animation 中,通过设置 linkage=true
即可开启联动。
animation({
// 开启联动
linkage: true,
// 在时间线上指定每个元素的动画
timeline: [
{ targets: '#box1', type: 'sideLeft'},
{ targets: '#box2', type: 'sideTop'},
{ targets: '#box3', type: 'sideBottom'},
{ targets: '#box4', type: 'sideRight'},
],
})
类似 vue.js 的 transition
组件,通过 v-show 可以轻松使用动画的正向反向状态的切换,并且在动画 enter 时和 leave 后移除和显式(调整 css 的 display 值) dom 元素。animation 也为你提供了类似的方法 toggle()
。
const ani = animation({
// 开启 dom 的移除和显式
dom: true,
type: 'sideLeft'
})
// 将会正向反向互相进行动画
ani.toggle()
FAQs
一个基于 anime.js 的动画库,更加便捷与实用。
The npm package @ntbl/animation receives a total of 2 weekly downloads. As such, @ntbl/animation popularity was classified as not popular.
We found that @ntbl/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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.