Guest User

Untitled

a guest
Sep 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. async function animateWrapper() {
  2. for (let i = 0; i < lines.length; i++) {
  3. let line = lines[i];
  4.  
  5. console.log(i)
  6. if(i==80){
  7. //alert("Success")
  8. $("div.success").fadeIn( 300 ).delay( 1500 ).fadeOut( 400 );
  9. const pStandby = line.node().getPointAtLength(line.node().getTotalLength());
  10. g.append("circle").attr("cx", pStandby.x).attr("cy", pStandby.y).attr("r", 5).style("fill", "red").style("opacity", "1");
  11. await sleep(3000);
  12. }
  13.  
  14. function tweenDash() {
  15. return function (t) {
  16. const l = line.node().getTotalLength();
  17. const interpolate = d3.interpolateString("0," + l, l + "," + l);
  18. const marker = d3.select("#marker");
  19. marker.style("fill", line.attr('marker-color'));
  20. const p = line.node().getPointAtLength(t * l);
  21. marker.attr("transform", "translate(" + p.x + "," + p.y + ")"); //move marker
  22. //console.log(t)
  23. return interpolate(t);
  24. }
  25. }
  26.  
  27. await animate(line, tweenDash);
  28. }
  29. }
  30.  
  31. $("div.success").fadeIn( 300 ).delay( 1500 ).fadeOut( 400 );
  32.  
  33. <div class="alert-box success">Successful Alert !!!</div>
Add Comment
Please, Sign In to add comment