Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. $(function () {
  2. var canvasWidth= $("#canvas").width();
  3. var canvasHeight= $("#canvas").height();
  4. var r=canvasWidth/26;
  5. var h=canvasHeight/2;
  6. var paper = Raphael("canvas",canvasWidth, canvasHeight);
  7. paper.customAttributes.anim= function (xloc, yloc, value, total, Rx,Ry,t) {
  8. var alpha = 360 / total * value,
  9. a = (90 - alpha) * Math.PI / 180,
  10. x = xloc + Rx * Math.cos(a),
  11. y = yloc - Ry * Math.sin(a),
  12. path;
  13. if (total == value) {
  14. path = [
  15. ["M", xloc, yloc - Ry],
  16. ["A", Rx, Ry, t, 1, 1, xloc - 0.01, yloc - Ry]
  17. ];
  18. } else {
  19. path = [
  20. ["M", xloc, yloc - Ry],
  21. ["A", Rx, Ry ,t, +(alpha > 180), 1, x, y]
  22. ];
  23. }
  24. return {
  25. path: path
  26. };
  27. };
  28.  
  29. c = paper.path().attr({
  30. "stroke": "#cbc",
  31. "stroke-width": 3,
  32. anim: [10*r, h, 0, 100, r,2*r,-30]
  33. });
  34. c.animate({
  35. anim: [10*r, h, 100, 100, r,2*r,-30]}, 2500, "ease-in-out",function(){
  36. });
  37.  
  38.  
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement