Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. var n = 360;
  2. var x = [], y = [];
  3.  
  4. Plotly.plot('view', [{
  5. x: x,
  6. y: y,
  7. mode: 'markers'
  8. }], {
  9. xaxis: {range: [-50, 50]},
  10. yaxis: {range: [-50, 50]}
  11. })
  12.  
  13.  
  14. function compute () {
  15. var angle = 3 * Math.PI / 180;
  16.  
  17. for(var i = 0; i < n; i++){
  18. x[i] = 0 + 25 * Math.cos(angle);
  19. y[i] = 0 + 25 * Math.sin(angle);
  20.  
  21. angle += 3 * Math.PI / 180;
  22. }
  23. }
  24.  
  25. function update () {
  26. compute();
  27.  
  28. Plotly.animate('simulation-view', {
  29. data: [{x: x, y: y}]
  30. }, {
  31. transition: {
  32. duration: 0,
  33. },
  34. frame: {
  35. duration: 0,
  36. redraw: false,
  37. }
  38. });
  39.  
  40. requestAnimationFrame(update);
  41. }
  42.  
  43. requestAnimationFrame(update);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement