88f2886620302a998753f9f2204abfd6f0ccd79438e34a98ed11d4ab6f51218f073cb745779ec0d00a7c9df595059e0505e03086135844ce82bda6d867c289 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf8" />
  5. <title>clone</title>
  6. <style>
  7. html, body, #canvas {
  8. width: 100%;
  9. height: 100%;
  10. margin: 0px;
  11. padding: 0px;
  12. }
  13. </style>
  14. <script src="../../dist/crender.map.js"></script>
  15. </head>
  16. <body>
  17. <canvas id="canvas"></canvas>
  18. </body>
  19. <script>
  20. const { CRender, extendNewGraph } = window.CRender
  21. const render = new CRender(document.querySelector('#canvas'))
  22. const [w, h] = render.area
  23. const circle = render.add({
  24. name: 'circle',
  25. animationCurve: 'easeOutCubic',
  26. animationFrame: 50,
  27. drag: true,
  28. hover: true,
  29. shape: {
  30. rx: w / 2,
  31. ry: h / 2,
  32. r: 100
  33. },
  34. style: {
  35. fill: '#ffee97',
  36. stroke: 'goldenrod',
  37. lineWidth: 2
  38. }
  39. })
  40. const circleCloned = render.clone(circle)
  41. circle.animation('shape', {
  42. rx: w / 2 - 150
  43. }, true)
  44. circleCloned.animation('shape', {
  45. rx: w / 2 + 150
  46. })
  47. </script>
  48. </html>