|
Last change
on this file since a762898 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
742 bytes
|
| Line | |
|---|
| 1 | function styleInterpolate(name, i, priority) {
|
|---|
| 2 | return function(t) {
|
|---|
| 3 | this.style.setProperty(name, i.call(this, t), priority);
|
|---|
| 4 | };
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | function styleTween(name, value, priority) {
|
|---|
| 8 | var t, i0;
|
|---|
| 9 | function tween() {
|
|---|
| 10 | var i = value.apply(this, arguments);
|
|---|
| 11 | if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
|---|
| 12 | return t;
|
|---|
| 13 | }
|
|---|
| 14 | tween._value = value;
|
|---|
| 15 | return tween;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | export default function(name, value, priority) {
|
|---|
| 19 | var key = "style." + (name += "");
|
|---|
| 20 | if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
|---|
| 21 | if (value == null) return this.tween(key, null);
|
|---|
| 22 | if (typeof value !== "function") throw new Error;
|
|---|
| 23 | return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.