-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We can’t wait until the tweens are initialized in transition.{attr,style,text}; we must compute the target value synchronously. The resulting value is stored in a map on the transition schedule so that tweens can still be efficiently copied on write and shared across instances.
- Loading branch information
Showing
4 changed files
with
39 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import {tweenValue} from "./tween"; | ||
|
||
function textConstant(value) { | ||
return value = value == null ? "" : value + "", function() { | ||
return function() { | ||
this.textContent = value; | ||
}; | ||
} | ||
|
||
function textFunction(value) { | ||
return function() { | ||
var v = value.apply(this, arguments); | ||
if (v == null) v = ""; | ||
this.textContent = v; | ||
var value1 = value(this); | ||
this.textContent = value1 == null ? "" : value1; | ||
}; | ||
} | ||
|
||
export default function(value) { | ||
return this.tween("text", (typeof value === "function" | ||
? textFunction | ||
: textConstant)(value)); | ||
return this.tween("text", typeof value === "function" | ||
? textFunction(tweenValue(this, "text", value)) | ||
: textConstant(value == null ? "" : value + "")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters