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