@f/animate

中文文档
1.0.1发布于 2016/02/04MITCommonJS近 30 天下载 3.8万

Animate properties using requestAnimationFrame and a custom render function

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. API
  4. animate(start, end, render, duration, easing)
  5. License

animate

Build status Git tag NPM version Code style

Animate properties using requestAnimationFrame and a custom render function

Installation

$ npm install @f/animate

Usage

var animate = require('@f/animate')
var applyStyles = require('@f/apply-styles')

animate({width: 10}, {width: 100}, props => applyStyles(element, props))

API

animate(start, end, render, duration, easing)

  • start - The initial value of the properties you want to animate
  • end - The final value of the properties you want to animate
  • render - A function that receives render(props, t) where props is the interpolated properties, and t is the frame number.
  • duration - The duration in milliseconds. Defaults to 350ms.
  • easing - An easing function that accepts a frame number and interpolates it along an easing curve.

Returns: A stop function. Call it if you want to cancel an in-flight animation.

License

MIT

版本与发布记录

@f/animate 共发布 2 个版本,首次发布于 2016/02/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2016/02/0410 年前
1.0.02016/02/0310 年前

关于 @f/animate 的常见问题

@f/animate 是什么?

Animate properties using requestAnimationFrame and a custom render function

如何安装 @f/animate?

在项目目录运行 npm install @f/animate,或使用 pnpm add / yarn add / bun add。

@f/animate 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/f__animate 是否存在。

@f/animate 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@f/animate 可以商用吗?

@f/animate 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@f/animate 的下载量有多少?

根据 npm 官方下载统计,@f/animate 在 2026/10/14 – 2026/11/12 这 30 天内被下载 37,562 次,日均约 1,252 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@f/animate 还在维护吗?

最新版本 1.0.1 发布于 2016/02/04(10 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2016/02/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。