CDT
CDT

Reputation: 10651

jQuery - What is a Tween object?

I have come across this term for quite a few times, but I can't find detailed definition about it.
For example, parameter fx in some jQuery methods is Tween.init.

Can anyone offer some help ?

Upvotes: 23

Views: 9767

Answers (2)

hashchange
hashchange

Reputation: 7225

The objects and methods used around jQuery animations - tweens, tweeners, hooks, prefilters, etc - are very poorly documented, even though they appear to be part of the public API. Perhaps it helps to list some resources here.

This is what the draft documentation has to say about the properties and methods of the Tween object:

  • elem: The element being animated
  • prop: The property being animated
  • easing: The easing used
  • options: A reference to the animation options
  • start: The starting value of the tween
  • now: The current value of the tween
  • end: The ending value of the tween
  • unit: The CSS unit for the tween
  • cur(): Reads the current value for property from the element
  • run( progress ): progress is a number from 0 to 1. Updates the value for the property on the animated element.

A Tween instance is passed to the step callback of a jQuery animation and can be used to manipulate the animation while it is in progress. Knowing about the Tween API might come in handy there.

Upvotes: 11

Ryan McDonough
Ryan McDonough

Reputation: 10012

Tween is used in animation in JQuery. Tween.js being a standalone example of Tween.

Short for in-betweening, the process of generating intermediate frames between two images to give the appearance that the first image evolves smoothly into the second image. Tweening is a key process in all types of animation, including computer animation. Sophisticated animation software enables you to identify specific objects in an image and define how they should move and change during the tweening process.

From http://www.webopedia.com/TERM/T/tweening.html

Upvotes: 20

Related Questions