.dial()
Syntax Variants
Parameters
- state1
- a property map in
set()syntax describing the first state of the properties. The properties will be set for all elements of the list. - state2
- a property map describing the second state of the properties. Uses
set()syntax. - linearity (optional)
- defines whether the animation should be linear (1), very smooth (0) or something in between. Default: 0. Ignored if durationMs is 0.
- interpolationFunc (optional)
- an interpolation
function(startValue, endValue, t)which will be called every time an interpolated value is required:- startValue
- The start value of the transition.
- endValue
- The end value of the transition.
- t
- A value between 0 and 1 that specifies the state of the transition.
- (callback return value)
- The value at the time t.
- (return value)
- a dial function
function(newPosition)that will set the state.- newPosition
- If 0 or lower, set the list members to the first state. If 1 or higher, sets them to the second state. For any value betweeen 0 and 1, the list members will be set to interpolated values.
Description
Creates a function allows you to set all list members to one of two states or any transitional state between them.
The states are specified using set() - compatible object maps containing the properties to set.
Pass 0 to the function to set the first state for all list members, or 1 to set the second state.
Any value between 0 and 1 will cause dial() to interpolate between the two states.
Interpolation is supported for all numeric values, including those that have a string suffix (e.g. 'px' unit),
and for colors in all RGB notations (e.g. '#f00', '#f0d1ff' or 'rgb(23,0,100)').
You can use the optional third parameter to define the kind of interpolation to use for values between 0 and 1. If 0, the dial uses a smooth, cubic interpolation. For 1 it uses linear interpolation. Values between 0 and 1 will mix both algorithms. You can also specify your own interpolation function.
Example
Creates a dial function that changes the background color of the page.
var light = $('body').dial({$backgroundColor: #000}, {$backgroundColor: #fff});
light(0); // set the first state (background color to #000)
light(1); // sets second state (background color to #fff).
light(0.5); // interpolates between two states, sets background color to #888.
light(0.25); // interpolates between two states, sets background color to #444.
See also..
toggle()is a related function that allows you to define two states and automatically animate between them.
Comments
comments powered by DisqusFunctions
- $() Web
- list.length Web, Util
- $$() Web
- $.getCookie()
- $.loop() Web
- $.off() Web
- $.parseJSON() Web
- $.ready() Web
- $.request() Web
- $.setCookie()
- $.toJSON() Web
- $.wait()
- .add() Web
- .addAfter() Web
- .addBefore() Web
- .addFront() Web
- .animate() Web
- .array() Util
- .call() Util
- .clone() Web
- .collect() Web, Util
- .contains() Util
- .dial() Web
- .each() Web, Util
- .endsWith() Util
- .equals() Util
- .fill() Web
- .filter() Web, Util
- .find() Web, Util
- .findLast() Web, Util
- .get() Web
- .hide() Web
- .ht()
- .intersection() Util
- .is() Web
- .join() Util
- .map() Util
- .merge() Util
- .next() Web
- .not() Web
- .offset()
- .on() Web
- .onChange() Web
- .onClick() Web
- .onFocus() Web
- .onOver() Web
- .only()
- .per() Util
- .reduce() Util
- .remove() Web
- .replace() Web
- .reverse() Util
- .select() Web
- .set() Web
- .show() Web
- .sort() Util
- .startsWith() Util
- .sub() Web, Util
- .text() Web
- .toObject() Util
- .toggle() Web
- .trav() Web
- .trigger() Web
- .uniq() Util
- .unite() Util
- .up() Web
- .values() Web
- EE() Web
- HTML() Web
- M Web, Util
- MINI.getter Web
- MINI.setter Web
- Minified Lists Web, Util
- Promise Web, Util
- _() Util
- _.bind() Util
- _.copyObj() Util
- _.dateAdd() Util
- _.dateClone() Util
- _.dateDiff() Util
- _.dateMidnight() Util
- _.eachObj() Util
- _.escapeHtml() Util
- _.escapeRegExp() Util
- _.extend() Util
- _.filterObj() Util
- _.format() Util
- _.formatHtml() Util
- _.formatValue() Util
- _.isBool() Util
- _.isDate() Util
- _.isEmpty() Util
- _.isFunction() Util
- _.isList() Util
- _.isNumber() Util
- _.isObject() Util
- _.isString() Util
- _.isValue() Util
- _.keys() Util
- _.mapObj() Util
- _.pad() Util
- _.parseDate() Util
- _.parseNumber() Util
- _.partial() Util
- _.promise()
- _.range()
- _.template() Util
- _.toString() Util
- _.trim() Util
- _.values() Util
- define() Web, Util
- promise.always()
- promise.error() Web, Util
- promise.fire()
- promise.stop()
- promise.then() Web
- require() Web, Util
- How to...