Skip to content
Ryc O'Chet edited this page Jun 3, 2018 · 2 revisions
- NOTE: This documentation is for Velocity v2.

Command - Tween

The "tween" command allows you to get the value of an animation at a specific point in time without having to run the animation. Because this is not an active animation, it will use the current properties on that element, so [forcefeeding](Advanced - Forcefeeding.md) is strongly advised.

element.velocity("tween", 0.5, { opacity: [0, 1] }; // returns 0.5
element.velocity("tween", 0.5, { opacity: [0, 1], height: [ "20px", "10px" ] }; // returns { opacity: 0.5, height: "15px" }

If more than one element is supplied then the result will be an array of values in the same order as the original elements array.

Calling "tween" is almost identical to creating a normal animation, simply with the "tween" command first.