Skip to content

Releases: jeremyckahn/shifty

Hotfix for 2.13.1

01 Dec 14:31
Compare
Choose a tag to compare

Fixes an unsafe method reference: fe485ce

Prevent multiple Date.now calls per tick

01 Dec 03:04
Compare
Choose a tag to compare

A teeny-tiny release that won't affect most folks. It'll make animation timing slightly more accurate for animations with a very large number of synchronized tweens (as in, thousands).

Performance improvements

03 Oct 23:32
Compare
Choose a tag to compare

This release makes Shifty faster. It significantly reduces memory overhead by reusing objects and variables instead of re-declaring and initializing them.

The only functional change is trivial, but may potentially result in harmless warnings in some environments (specifically Node): e277dc7

If you see a warning in Node, simply add a .catch() to the Tween Promise or wrap it in a try/catch (which is a good practice for Promises generally).

Diff: v2.12.0...v2.13.0

Add .cancel() and .data() methods

19 Aug 17:59
Compare
Choose a tag to compare

Adds cancel and data methods.

const { Tweenable } = shifty

const tweenable = new Tweenable()

;(async () => {
  const element = document.querySelector('#tweenable')

  while (true) {
    try {
      await tweenable.tween({
        render: ({ x }) => {
          element.style.transform = `translateX(${x}px)`
        },
        data: { hello: 'world' },
        easing: 'easeInOutQuad',
        duration: 400,
        from: { x: 0 },
        to: { x: 200 },
      })

      await tweenable.tween({
        to: { x: 0 },
      })
    } catch (e) {
      console.log(e.tweenable.data())
      break
    }
  }
})()

document.querySelector('#cancel').addEventListener('click', () => {
  tweenable.cancel()
})

See:

Fix compatibility bug introduced by 2.11.0

17 Aug 03:59
Compare
Choose a tag to compare

Improved async/await support and property names

16 Aug 23:15
Compare
Choose a tag to compare

Shifty 2.11.0 improves support for async/await. Now code like this can be written:

import { tween } from 'shifty'

const animate = async () => {
  const element = document.querySelector('#tweenable')

  const { tweenable } = await tween({
    render: ({ scale, x }) => {
      element.style.transform = `translateX(${x}px) scale(${scale})`
    },
    easing: 'easeInOutQuad',
    duration: 500,
    from: { scale: 1, x: 0 },
    to: { x: 200 },
  })

  await tweenable.tween({
    to: { x: 0 },
  })

  await tweenable.tween({
    to: { scale: 3 },
  })
}

This release also changes how tweens resolve, implicitly reuses config across tweens, renames step to render and attachment to data (with legacy property names supported).

See:

Remove promise rejection

14 Aug 18:57
Compare
Choose a tag to compare

Removes Promise rejection logic and updates devDependencies to stable versions.

See:

Fixes #117

06 Aug 19:02
Compare
Choose a tag to compare

This release fixes the infinite loop bug discovered by @kylewetton: #117

[BREAKING CHANGE] Improve error message when stop is called

13 May 12:46
Compare
Choose a tag to compare

v2.9.0 incorporates #115 to improve how tweens are rejected.

Specifically, it changes a tween's Promise reject callback signature from:

/**
 * @param {Object} currentState
 * @param {Object} attachment
 */
reject(currentState, attachment)

to

/**
 * @param {Object} data
 * @param {Object} data.currentState
 * @param {Object} data.attachment
 * @param {string} data.error
 */
reject(data)

Fixes node support

01 Mar 14:28
Compare
Choose a tag to compare

The toolchain updates in 2.7.0 broke Node compatibility. This release fixes that.