a0736c7d652d9b8c23fa3068a6cc6eecf7f9fda2.svn-base 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>dojoClass detail information</title>
  6. <style type="text/css">
  7. @import "../../../dojo/resources/dojo.css";
  8. @import "../../../dijit/themes/tundra/tundra.css";
  9. @import "../../../dijit/tests/css/dijitTests.css";
  10. #node {
  11. position:absolute;
  12. top:100px; left:100px;
  13. width:400px;
  14. height:400px;
  15. padding:12px;
  16. -moz-border-radius:5pt;
  17. overflow:hidden;
  18. border:1px solid #333;
  19. }
  20. </style>
  21. <script type="text/javascript"
  22. djConfig="parseOnLoad: true"
  23. src="../../../dojo/dojo.js"></script>
  24. <script type="text/javascript">
  25. dojo.require("dojo.parser");
  26. dojo.require("dojox.fx.easing");
  27. dojo.require("dojox.gfx");
  28. var surface, shape, line, node;
  29. dojo.addOnLoad(function(){
  30. // dojo._Line is just a simple class to hold some numbers, and return a given point
  31. // on the line as a percentage, essentially
  32. var _line = new dojo._Line(20,75); // a holder for the numbers 100..300
  33. console.log(_line,_line.getValue(0.5 /* Float: 0..1 */)); // should return 200
  34. node = dojo.byId('node');
  35. surface = dojox.gfx.createSurface(node,400,400);
  36. shape = surface.createCircle({ cx: 200, cy: 200, r: 20 })
  37. .setFill([0,0,255])
  38. .setStroke({ color:[128,128,128], width: 1});
  39. // so we just make a raw _Animation
  40. var _anim = new dojo._Animation({
  41. // the id of the shape
  42. node: node,
  43. // some easing options
  44. easing: dojox.fx.easing.easeInOut,
  45. // our radius start and end values
  46. curve:_line,
  47. // call transform on the shape with the values
  48. onAnimate: function(){
  49. shape.setShape({ r: arguments[0] });
  50. },
  51. duration:1200 // ms
  52. // rate:100 // ms, so duration/rate iterations
  53. });
  54. dojo.connect(_anim,"onEnd",function(){
  55. dojo.animateProperty({
  56. node: node,
  57. duration:1000,
  58. properties: {
  59. left: { end: 300, unit:"px" }
  60. },
  61. onEnd: function(){
  62. dojo.fadeOut({ node: node, duration:3000 }).play();
  63. }
  64. }).play(500);
  65. });
  66. _anim.play(2000);
  67. });
  68. </script>
  69. </head>
  70. <body class="tundra">
  71. <h1>animateProperty for dojox.gfx</h1>
  72. <div id="node"></div>
  73. </body>
  74. </html>