d3js V4 实现简单的动态效果
实现简单的动态效果 d3js V4版本
馒头华华v3版本地址:http://d3.decembercafe.org/pages/lessons/9.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>实现简单的动态效果</title> </head> <body> <script src="https://d3js.org/d3.v4.min.js"></script> <script> var width = 700; var height = 700; var svg = d3.select('body').append('svg').attr('width',width).attr('height',height); var circle = svg.append('circle') .attr('cx',100) .attr('cy',100) .attr('r',50) .attr('fill','pink'); circle.transition() .duration(2000) .attr('cx',350) .attr('fill','red') .attr('r',25) d3.easeLinear(circle);//V4版本 </script> </body> </html>