I have created a svg
where I have the animation of a rectangle
, and I would like to convert the duration of this animation (in this case 5 seconds) to a video
.
I am relying on this example:
https://plnkr.co/edit/SA4LfCHCbHcBxA48?open=lib%2Fscript.js&preview
but I don't know if it applies to my case, I have seen in some places that everything is done directly on a canvas
, or the svg
is somehow converted to an image
or something like that. I tried to mimic the link logic, but I also get problems because that version of d3.js
is older than mine.
how can do it?
d3.select("#visualization").append('svg');
var vis = d3.select("svg").attr("width", 800).attr("height", 614).style("border", "1px solid red");
var rectangle = vis.append("rect").attr("width", 100).attr("height", 70).attr("x", 0).attr("y", 50);
rectangle
.transition()
.duration(5000)
.ease(d3.easeLinear)
.attr("x", 250)
.attr("width", 100)
.attr("height", 100)
.attr("opacity", 0.5)
.attr("fill", "red");
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<div id="visualization"></div>