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