text#1.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <screenplay xmlns="urn:screenplay">
  3. <text id="partial" />
  4. <text id="type" text="Typewriter" />
  5. <int id="typeLength" value="0" />
  6. <event kind="onLoad" >
  7. <matrix id="initialMatrix" translate="[65,100]" />
  8. <paint id="textPaint" textSize="36" antiAlias="true" linearText="false" >
  9. <color color="lightBlue" />
  10. </paint>
  11. <apply >
  12. <paint />
  13. <set begin="3" field="linearText" to="false" />
  14. </apply>
  15. <matrix translate="[0,60]" />
  16. <rect top="textPaint.ascent" width="textPaint.measureText(type.text)"
  17. height="-textPaint.ascent+textPaint.descent" />
  18. <paint>
  19. <linearGradient points="[0,25,205,25]" tileMode="mirror" >
  20. <matrix>
  21. <scale x="3" y="2" />
  22. </matrix>
  23. <color color="brown" />
  24. <color color="yellow" />
  25. </linearGradient>
  26. </paint>
  27. <add use="partial" />
  28. <textOnPath text="partial" offset="220" >
  29. <path >
  30. <addOval left="0" right="160" top="-70" bottom="30" direction="cw" />
  31. </path>
  32. </textOnPath>
  33. <textOnPath text="partial" offset="20" >
  34. <path >
  35. <addOval left="0" right="160" top="-50" bottom="50" direction="cw" />
  36. </path>
  37. </textOnPath>
  38. <apply mode="immediate" steps="type.length-1" >
  39. <post target="nextChar" />
  40. <animate field="delay" from="0.1" to="0.95" />
  41. </apply>
  42. <post target="addCaptionFade" delay="1" />
  43. <post target="addLineCaption" delay="1" />
  44. <post target="scaleInitial" delay="2" />
  45. </event>
  46. <event kind="user" id="nextChar" >
  47. <apply id="applyTypeLength" scope="typeLength" >
  48. <set id="incValue" field="value" to="typeLength.value + 1" />
  49. </apply>
  50. <apply id="applySlice" scope="partial">
  51. <set id="setSlice" field="text" to="#script:type.text.slice(0, typeLength.value)" />
  52. </apply>
  53. </event>
  54. <event kind="user" id="addCaptionFade" >
  55. <apply>
  56. <paint >
  57. <color id="captionFade" alpha="0" />
  58. </paint>
  59. <animate target="captionFade" field="alpha" from="0" to="1" dur="1" />
  60. </apply>
  61. </event>
  62. <event kind="user" id="addLineCaption" >
  63. <paint textSize="24" textAlign="center" > <!-- -->
  64. <shader />
  65. </paint>
  66. <text text="Text" x="textPaint.measureText(type.text)/2" y="40" />
  67. </event>
  68. <event kind="user" id="scaleInitial" >
  69. <apply scope="textPaint" >
  70. <set field="linearText" to="true" />
  71. </apply>
  72. <apply scope="initialMatrix" >
  73. <animate field="scale" from="1" to=".5" dur="1"/>
  74. <animate field="translateX" from="65" to="130" dur="1"/>
  75. <animate field="translateY" from="100" to="30" dur="1"/>
  76. </apply>
  77. </event>
  78. </screenplay>