Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <svg height='600' width='600'></svg>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js">
- </script>
- <script>
- let svg = d3.select('svg');
- let circle =
- svg
- .append('circle')
- .attr('fill', 'red');
- repeat();
- function repeat() {
- circle
- .attr('cx', 50)
- .attr('cy', 50)
- .attr('r', 10)
- .transition()
- .delay(500)
- .duration(3000)
- .attr('cx', 300)
- .attr('cy', 300)
- .attr('r', 100)
- .attr('fill', 'black')
- .ease(d3.easeElastic)
- .transition()
- .delay(500)
- .duration(3000)
- .attr('cx', 50)
- .attr('cy', 50)
- .attr('fill', 'red')
- .attr('r', 10)
- .ease(d3.easeCircle)
- .on('end', repeat);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement