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. TI Code Composer Studio MSP430系列驱动源代码

    一.参考TI官网驱动源代码 安装打开Code Composer Studio,如下图所示,最近在调试MSP430G2533的AD,需要参考官网的底层驱动配置. 从Code Composer Studi ...

  2. 使用virtualenv搭建python虚拟开发环境

    在使用python做开发时,如果多人需要在同一台机器上工作,或者机器环境经常变化时, 添加或删除一些python包很可能会影响到你自己的开发环境. 因此,通过virtualenv工具可以创建一个完全属 ...

  3. udacity android 学习笔记: lesson 4 part a

    udacity android 学习笔记: lesson 4 part a 作者:干货店打杂的 /titer1 /Archimedes 出处:https://code.csdn.net/titer1 ...

  4. tcp_tw_recycle检查tcp_timestamps的内核代码

    注意:本文档中的内核代码的版本号:linux-4.0.5 /************************************************* * Author : Samson * ...

  5. Python命令行參数大全

      -b     :    当转换数组为字符串时提出警告.比方str(bytes_instance), str(bytearray_instance). -B     :    当导入.py[co]文 ...

  6. RvmTranslator6.3 is released

    RvmTranslator6.3 is released eryar@163.com RvmTranslator can translate the RVM file exported by AVEV ...

  7. ctags 寻找方法定义处

    ctags这个是vim的一个插件,它可以用来生成一个检索文件,里面保存有一些索引信息.例如,一些类跟方法.变量等的定义位置当我们对一个路径执行ctags -R的时候,就会自动生成一个ctags,然后我 ...

  8. 圆形头像CircleImageView和Cardview使用

    效果: 圆形头像在我们的日常使用的app中很常见,因为圆形的头像比较美观. 使用圆形图片的方法可能有我们直接将图片裁剪成圆形再在app中使用, 还有就是使用自定义View对我们设置的任何图片自动裁剪成 ...

  9. sql中去掉换行符和回车符

    sql 中,char(13),char(10)或nchar(13),nchar(10)可表示SQL中的回车换行符,但是会以空格的形式显示.replace(replace(字段名,char(10), ' ...

  10. C# 正整数和非零正整数校验

    /// <summary> /// 1. 校验正整数(包含0) /// </summary> public static bool isInterger(string str) ...