D3 transitions start executing as soon as they’re created, and they’re destroyed once they end. This can present some challenges when attempting to create reusable transitions. This lesson demonstrates how to overcome those challenges using various approaches to reusable transitions.

We can put reuseable transtion into a function, then use .call() method to use that transition.

d3.select('#block')
.transition()
.call(configure, , , d3.easePolyOut)
.style('width', '400px')
.transition()
.call(configure, , , d3.easeBounceOut)
.style('height', '500px')
.transition()
.call(configure, , , d3.easeQuadOut)
.style('background-color', 'gold') ; function configure (transition, delay, duration, ease) {
return transition.delay(delay).duration(duration).ease(ease);
}

[D3] Reuse Transitions in D3 v4的更多相关文章

  1. [D3] Animate Transitions in D3 v4

    D3 makes it easy to add meaningful animations to your data visualizations. Whether it’s fading in ne ...

  2. D3.js 入门学习(二) V4的改动

    //d3.scan /* 新的d3.scan方法对数组进行线性扫描,并根据指定的比较函数返回至少一个元素的索引. 这个方法有点类似于d3.min和d3.max. 而d3.scan可以得到极值的索引而不 ...

  3. D3学习之:D3.js中的12中地图投影方式

    特别感谢:1.[张天旭]的D3API汉化说明.已被引用到官方站点: 2.[馒头华华]提供的ourd3js.com上提供的学习系列教程,让我们这些新人起码有了一个方向. 不得不说,学习国外的新技术真的是 ...

  4. [D3] Drawing path in D3

    Here we have a force layout with three nodes. In the example, we will link three nodes with line and ...

  5. [D3] Animate Chart Axis Transitions in D3 v4

    When the data being rendered by a chart changes, sometimes it necessitates a change to the scales an ...

  6. D3——Updates, Transitions, and Motion

    <script type="text/javascript"> ; ; ; , , , , , , , , , ,, , , , , , , , , ]; //crea ...

  7. [D3] 12. Basic Transitions with D3

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  8. [D3] Margin Convention with D3 v4

    You can’t add axes to a chart if you don’t make room for them. To that end, the D3 community has ado ...

  9. [D3] Basic Interactivity with D3 v4

    Data visualizations are a lot more interesting when they’re interactive. Whether it’s clicks, roll o ...

随机推荐

  1. Linux下java/bin目录下的命令集合

    Linux下JAVA命令(1.7.0_79) 命令 详解 参数列表 示例 重要程度 资料 appletviewer Java applet 浏览器.appletviewer 命令可在脱离万维网浏览器环 ...

  2. 学习《Python金融实战》中文版PDF+英文版PDF+源代码

    学习python处理金融数据,建议学习<Python金融实战>,比较实用,只不过Yahoo财经的API改了,书里的方法不再有效要改一改,还有就是会有一些代码缩进小问题,总体上对金融分析很实 ...

  3. android与C# WebService基于ksoap通信(C#篇)

    1.打开VS 2013新建项目>>ASP.NET空WEB应用程序(我用的是.net 4.0) 2.在刚建立的项目上加入新建项(WebService) 这时TestService的代码例如以 ...

  4. ORACLE-016:ora-01720 授权选项对于&#39;xxxx&#39;不存在

    报错的情形例如以下. A用户:视图V_A B用户:视图V_B,而且用到了V_A C用户:须要用V_B, 授权过程, A用户下: grant select on V_A to B B用户下: grant ...

  5. 基于二叉树和双向链表实现限制长度的最优Huffman编码

    该代码採用二叉树结合双向链表实现了限制长度的最优Huffman编码,本文代码中的权重所有採用整数值表示.http://pan.baidu.com/s/1mgHn8lq 算法原理详见:A fast al ...

  6. selection-内容选中跟光标移动

    如果我们希望手动的改变edittext的光标,我们可以使用 setSelection(int start, int end); setSelection(int index); 这个方法,如果我们选择 ...

  7. Razor小案例

    Model using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace ...

  8. 完整性检查工具Nabou

    完整性检查工具Nabou 650) this.width=650;" onclick="window.open("http://blog.51cto.com/viewpi ...

  9. Stacked Autoencoders

    转自:http://www.cnblogs.com/tornadomeet/archive/2013/03/25/2980357.html 如果使用多层神经网络的话,那么将可以得到对输入更复杂的函数表 ...

  10. spring webSocket The HTTP response from the server [200] did not permit the HTTP upgrade to WebSocket

    在springboot 1.5.9版本 WebSocketConfig配置 registry.addEndpoint("/webSocket").withSockJS();在加了. ...