You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interpolators are now reused across elements with transition.{attr,style},
improving performance. This is possible because transitions now invoke tween
functions with this as the current node (like most other functions).
Fix#49 by removing styles at the end of transitions where appropriate.
Fix#89 by removing event listeners where appropriate.
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -307,9 +307,9 @@ For example, to interpolate the fill attribute to blue, like [*transition*.attr]
307
307
308
308
```js
309
309
transition.tween("attr.fill", function() {
310
-
varnode =this, i =d3.interpolateRgb(node.getAttribute("fill"), "blue");
310
+
var i =d3.interpolateRgb(this.getAttribute("fill"), "blue");
311
311
returnfunction(t) {
312
-
node.setAttribute("fill", i(t));
312
+
this.setAttribute("fill", i(t));
313
313
};
314
314
});
315
315
```
@@ -420,7 +420,7 @@ Immediately after creating a transition, such as by [*selection*.transition](#se
420
420
421
421
Shortly after creation, either at the end of the current frame or during the next frame, the transition is scheduled. At this point, the delay and `start` event listeners may no longer be changed; attempting to do so throws an error with the message “too late: already scheduled” (or if the transition has ended, “transition not found”).
422
422
423
-
When the transition subsequently starts, it interrupts the active transition of the same name on the same element, if any, dispatching an `interrupt` event to registered listeners. (Note that interrupts happen on start, not creation, and thus even a zero-delay transition will not immediately interrupt the active transition: the old transition is given a final frame. Use [*selection*.interrupt](#selection_interrupt) to interrupt immediately.) The starting transition also cancels any pending transitions of the same name on the same element that were created before the starting transition. The transition then dispatches a `start` event to registered listeners. This is the last moment at which the transition may be modified: after starting, the transition’s timing, tweens, and listeners may no longer be changed; attempting to do so throws an error with the message “too late: already started” (or if the transition has ended, “transition not found”). The transition initializes its tweens immediately after starting.
423
+
When the transition subsequently starts, it interrupts the active transition of the same name on the same element, if any, dispatching an `interrupt` event to registered listeners. (Note that interrupts happen on start, not creation, and thus even a zero-delay transition will not immediately interrupt the active transition: the old transition is given a final frame. Use [*selection*.interrupt](#selection_interrupt) to interrupt immediately.) The starting transition also cancels any pending transitions of the same name on the same element that were created before the starting transition. The transition then dispatches a `start` event to registered listeners. This is the last moment at which the transition may be modified: the transition’s timing, tweens, and listeners may not be changed when it is running; attempting to do so throws an error with the message “too late: already running” (or if the transition has ended, “transition not found”). The transition initializes its tweens immediately after starting.
424
424
425
425
During the frame the transition starts, but *after* all transitions starting this frame have been started, the transition invokes its tweens for the first time. Batching tween initialization, which typically involves reading from the DOM, improves performance by avoiding interleaved DOM reads and writes.
tape("transition.style(name, value) creates an tween which removes the specified style post-start if the specified function returns null",function(test){
0 commit comments