first.html 618 B

123456789101112131415161718192021222324252627
  1. <html>
  2. <head>
  3. <title>Hello kity</title>
  4. <script src="../dist/kity.js"></script>
  5. </head>
  6. <body>
  7. <div id="kity_paper"></div>
  8. </body>
  9. <script type="text/javascript">
  10. window.onload = function () {
  11. var paper = new kity.Paper('kity_paper');
  12. var rect = paper.put(new kity.Rect());
  13. var text = paper.put(new kity.Text());
  14. text.setContent('hello kity!');
  15. text.fill('white');
  16. text.setX(100);
  17. text.setY(200);
  18. rect.setBox(text.getBoundaryBox().expand(15, 10, 15, 10));
  19. rect.setRadius(5);
  20. rect.fill('blue');
  21. };
  22. </script>
  23. </html>