Draw 3D ball : Canvas Draw « Dojo toolkit « JavaScript DHTML






Draw 3D ball

 

<html>
  <head>
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      dojo.require("dojox.gfx");
      function testIt() {
        var s = dojox.gfx.createSurface("my", 320, 240);
         s.createCircle({ cx : 265, cy : 120, r : 40}).setFill(dojo.mixin(
            { type : "radial", cx : 250, cy : 90},
            { colors: [
              { offset: 0,   color: [255, 0, 0, 0] },
              { offset: 0.5, color: "red" },
              { offset: 1,   color: [0, 0, 255, 0] }
            ]}
          ));
      }
    </script>
  </head>
  <body onLoad="testIt();">
        <div id="my"></div>
  </body>
</html>
       

   
  








Dojo-toolkit.zip( 3,849 k)

Related examples in the same category

1.Draw line
2.Draw polygon
3.Draw rectangle
4.Draw stroke
5.Draw text
6.Fill text
7.Shape rotation
8.Create Ellipse