@f/tween

WebJar for @f/tween

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

f__tween
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

@f/tween
WebJar for @f/tween
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/micro-js/tween

Скачать f__tween

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/f__tween/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>f__tween</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/f__tween/
implementation 'org.webjars.npm:f__tween:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/f__tween/
implementation ("org.webjars.npm:f__tween:1.0.1")
'org.webjars.npm:f__tween:jar:1.0.1'
<dependency org="org.webjars.npm" name="f__tween" rev="1.0.1">
  <artifact name="f__tween" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='f__tween', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "f__tween" % "1.0.1"
[org.webjars.npm/f__tween "1.0.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : f__map-obj jar [1.2.2,2)

Модули Проекта

Данный проект не имеет модулей.

tween

Build status Git tag NPM version Code style

Simple, purely functional tweening function.

Installation

$ npm install @f/tween

Usage

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

function animate (element, start, end, duration, easing, cb) {
  var tick = tween(start, end)
  var t = 0

  requestAnimationFrame(function ticker () {
    var props = tick(t)
    applyStyles(element, props)

    if (props !== end) {
      t++
      requestAnimationFrame(ticker)
    } else {
      cb()
    }
  })
}

animate(element, {width: 10, left: 2}, {width: 100, left: 200})

API

tween(start, end, duration, easing, interval)

  • start - Object containing the initial value of the properties you want to tween.
  • end - Object containing the final value of the properties you want to tween.
  • duration - The length of time, in milliseconds, your tween should be for. Defaults to 350ms.
  • easing - An easing function that takes a tick value and interpolates it according to some easing function. Defaults to linear.
  • interval - The tick length you want to use, in milliseconds. Defaults to 16.66ms (i.e. a single requestAnimationFrame timer).

Returns: A partially applied function that accepts a single parameter, t and returns the interpolated properties for that tick. The t parameter is a unitless value that corresponds to the frame of the tween you are requesting. So, if you are using requestAnimationFrame and the default interval, you just increment t once for each tick. t does not need to be an integer.

License

MIT

Версии библиотеки

Версия
1.0.1