|
Last change
on this file was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
599 bytes
|
| Line | |
|---|
| 1 | function textInterpolate(i) {
|
|---|
| 2 | return function(t) {
|
|---|
| 3 | this.textContent = i.call(this, t);
|
|---|
| 4 | };
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | function textTween(value) {
|
|---|
| 8 | var t0, i0;
|
|---|
| 9 | function tween() {
|
|---|
| 10 | var i = value.apply(this, arguments);
|
|---|
| 11 | if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
|
|---|
| 12 | return t0;
|
|---|
| 13 | }
|
|---|
| 14 | tween._value = value;
|
|---|
| 15 | return tween;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | export default function(value) {
|
|---|
| 19 | var key = "text";
|
|---|
| 20 | if (arguments.length < 1) 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, textTween(value));
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.