paths#1.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <screenplay xmlns="urn:screenplay">
  3. <array id="colors"
  4. values="[yellow,blue,green,red,orange,cyan,magenta,lime,navy,olive]" />
  5. <path id="path">
  6. <moveTo x="20" y="20" />
  7. <lineTo x="20" y="80" />
  8. <quadTo id="quad" x1="80" y1="80" x2="80" y2="20" />
  9. <close />
  10. </path>
  11. <event kind="onLoad">
  12. <matrix id="initialMatrix" translate="[120,150]" />
  13. <paint id="pathPaint" antiAlias="true">
  14. <color color="lightpink" />
  15. </paint>
  16. <apply >
  17. <paint />
  18. <set begin="3" field="linearText" to="false" />
  19. </apply>
  20. <apply scope="path" >
  21. <animate target="quad" field="x1" from="10" to="120" dur="1"/>
  22. <animate target="quad" field="y1" from="10" to="120" dur="1"/>
  23. </apply>
  24. <apply id="apply" mode="immediate" steps="colors.length-1" >
  25. <group id="newPath">
  26. <matrix rotate="360/colors.length" />
  27. <paint >
  28. <color id="color" />
  29. </paint>
  30. <add use="path" />
  31. </group>
  32. <set target="color" field="color" to="colors[apply.step]" />
  33. <set target="color" field="alpha" to=".5" />
  34. </apply>
  35. <post target="addCaptionFade" delay="1" />
  36. <post target="addLineCaption" delay="1" />
  37. <post target="scaleInitial" delay="2" />
  38. </event>
  39. <event kind="user" id="addCaptionFade" >
  40. <apply>
  41. <paint >
  42. <color id="captionFade" alpha="0" />
  43. </paint>
  44. <animate target="captionFade" field="alpha" from="0" to="1" dur="1" />
  45. </apply>
  46. </event>
  47. <event kind="user" id="addLineCaption" >
  48. <paint textSize="24" textAlign="center" > <!-- -->
  49. <shader />
  50. </paint>
  51. <text text="Paths" x="10" y="145" />
  52. </event>
  53. <event kind="user" id="scaleInitial" >
  54. <apply scope="pathPaint" >
  55. <set field="linearText" to="true" />
  56. </apply>
  57. <apply scope="initialMatrix" >
  58. <animate field="scale" from="1" to=".5" dur="1"/>
  59. <animate field="translateX" from="120" to="60" dur="1"/>
  60. <animate field="translateY" from="150" to="180" dur="1"/>
  61. </apply>
  62. </event>
  63. </screenplay>