$("#btn2").click(function () { $("#mysvg").animate( { strokeDasharray: 300 200, strokeDashoffset: 0, }, 1000 ); });