animator tests
authorreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 13 Oct 2009 13:33:53 +0000 (13:33 +0000)
committerreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 13 Oct 2009 13:33:53 +0000 (13:33 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@381 2bbb7eff-a529-9590-31e7-b0007b416f81

animations/chest#1.jpg [new file with mode: 0644]
animations/fire#1.jpg [new file with mode: 0644]
animations/images#1.xml [new file with mode: 0644]
animations/jet#1.jpg [new file with mode: 0644]
animations/lines#1.xml [new file with mode: 0644]
animations/movie#1.xml [new file with mode: 0644]
animations/paths#1.xml [new file with mode: 0644]
animations/redcross#1.jpg [new file with mode: 0644]
animations/text#1.xml [new file with mode: 0644]

diff --git a/animations/chest#1.jpg b/animations/chest#1.jpg
new file mode 100644 (file)
index 0000000..9ef7194
Binary files /dev/null and b/animations/chest#1.jpg differ
diff --git a/animations/fire#1.jpg b/animations/fire#1.jpg
new file mode 100644 (file)
index 0000000..6269ff7
Binary files /dev/null and b/animations/fire#1.jpg differ
diff --git a/animations/images#1.xml b/animations/images#1.xml
new file mode 100644 (file)
index 0000000..c6ad7a6
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8" ?> 
+<screenplay xmlns="urn:screenplay">
+
+       <event kind="onLoad">
+               <matrix id="initialMatrix" translate="[80,80]" />
+               <paint  id="imagePaint" antiAlias="true">
+                       <color color="lightpink" />
+               </paint>
+               <apply  >
+                       <paint />
+                       <set begin="4" field="linearText" to="false" />
+               </apply>
+               <save>
+                       <matrix>
+                               <scale x="0.5" y="0.5" />
+                       </matrix>
+               <image id="backImage" src="redcross.jpg" />
+               <save>
+                       <matrix id="polyMatrix">
+                               <polyToPoly >
+                                       <polygon>
+                                               <moveTo id="pt1" x="0" y="0" />
+                                               <lineTo id="pt2" x="256" y="0" />
+                                               <lineTo x="256" y="256" />
+                                               <lineTo x="0" y="256" />
+                                               <close />
+                                       </polygon>
+                                       <polygon >
+                                               <moveTo x="0" y="0" />
+                                               <lineTo x="256" y="0" />
+                                               <lineTo x="256" y="256" />
+                                               <lineTo x="0" y="256" />
+                                               <close />
+                                       </polygon>
+                               </polyToPoly>
+                       </matrix>
+                       <paint id="paintFade">
+                               <color id="fade" />
+                       </paint>
+                       <image id="frontImage" src="bulgaria.jpg" />
+               </save>
+               </save>
+               <apply begin="0.5" scope="polyMatrix">
+                       <animate id="pt1x" target="pt1" field="x" from="0" to="64" dur="0.5" repeat="3" />
+                       <animate target="pt1" field="y" from="0" to="-455" dur="0.5"  repeat="3"/>
+                       <animate target="pt2" field="x" from="256" to="192" dur="0.5"  repeat="3" />
+                       <animate target="pt2" field="y" from="0" to="-455" dur="0.5" repeat="3" />
+               </apply>
+               <apply begin="1" scope="backImage" >
+                       <set field="src" to="jet.jpg" />
+               </apply>
+               <apply begin="1" scope="frontImage" >
+                       <set field="src" to="redcross.jpg" />
+               </apply>
+               <apply begin="1.5" scope="backImage" >
+                       <set field="src" to="fire.jpg" />
+               </apply>
+               <apply begin="1.5" scope="frontImage" >
+                       <set field="src" to="jet.jpg" />
+               </apply>
+               <apply begin="2" scope="backImage" >
+                       <set field="src" to="chest.jpg" />
+               </apply>
+               <apply begin="2" scope="frontImage" >
+                       <set field="src" to="fire.jpg" />
+               </apply>
+               <apply begin="2" scope="paintFade" >
+                       <animate field="alpha" target="fade" from="1" to="0" dur=".5" />
+               </apply>
+               <post target="addCaptionFade" delay="2" />
+               <post target="addLineCaption" delay="2" />
+               <post target="scaleInitial" delay="3" />
+       </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="Images" x="70" y="160" />
+       </event>
+
+       <event kind="user" id="scaleInitial" >
+               <apply scope="imagePaint" >
+                       <set field="linearText" to="true" />
+               </apply>
+               <apply scope="initialMatrix" >
+                       <animate field="scale" from="1" to=".5" dur="1"/>
+                       <animate field="translateX" from="80" to="145" dur="1"/>
+                       <animate field="translateY" from="80" to="172" dur="1"/>
+               </apply>
+       </event>
+
+</screenplay>
diff --git a/animations/jet#1.jpg b/animations/jet#1.jpg
new file mode 100644 (file)
index 0000000..1a5a3e7
Binary files /dev/null and b/animations/jet#1.jpg differ
diff --git a/animations/lines#1.xml b/animations/lines#1.xml
new file mode 100644 (file)
index 0000000..fe120a1
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8" ?> 
+<screenplay xmlns="urn:screenplay">
+       <line id="line" x1="0" y1="0" x2="100" y2="0" />
+       <random id="rRed" min="0" max="255" seed="1900"  />
+       <random id="rBlue" min="0" max="255" seed="50000"  />
+       <random id="rGreen" min="0" max="255" seed="99"  />
+       
+       <event kind="onLoad" >
+               <matrix id="initialMatrix" translate="[120,100]" />
+               <paint id="basePaint" strokeWidth="2" antiAlias="true" textAlign="center" 
+                               textSize="24" linearText="false" >
+                       <color color="lightblue" />
+               </paint>
+               <apply mode="immediate" steps="17" >
+                       <post target="addLine" />
+                       <animate field="delay" from="0.1" to="0.95" />
+               </apply>
+               <post id="postAddCaptionFade" target="addCaptionFade" delay="1" />
+               <post id="postAddLineCaption"  target="addLineCaption" delay="1" />
+               <post target="scaleInitial" delay="2" />
+               <apply scope="basePaint"  begin="3">
+                       <set begin="0" field="linearText" to="false" />
+               </apply>
+       </event>
+
+       <event kind="user" id="addLine" >
+               <matrix rotate="20" />
+               <apply restore="true" >
+                       <paint >
+                               <color id="ramp" />
+                       </paint>
+                       <set target="ramp" field="color" to="rgb(rRed.random,rBlue.random,rGreen.random)" />
+               </apply>
+               <add use="line" />
+       </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" >
+               <text id="linescaption" text="Lines" x="0" y="120" />
+       </event>
+       
+       <event kind="user" id="scaleInitial" >
+               <apply scope="basePaint" >
+                       <set field="linearText" to="true" dur="1" reset="true" />
+               </apply>
+               <apply scope="initialMatrix" >
+                       <animate field="scale" from="1" to=".5" dur="1"/>
+                       <animate field="translateX" from="120" to="60" dur="1"/>
+                       <animate field="translateY" from="100" to="60" dur="1"/>
+               </apply>
+       </event>
+               
+<!--
+       <event kind="keyChar" key="d" >
+               <dump />
+       </event>
+-->
+</screenplay>
\ No newline at end of file
diff --git a/animations/movie#1.xml b/animations/movie#1.xml
new file mode 100644 (file)
index 0000000..872c7c2
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?> 
+<screenplay xmlns="urn:screenplay">
+
+       <event kind="user" id="pathsMovie" >
+               <movie src="paths.xml" />
+       </event>
+
+       <event kind="user" id="textMovie" >
+               <movie src="text.xml" />
+       </event>
+
+       <event kind="user" id="bitmapMovie" >
+               <movie src="images.xml" />
+       </event>
+       
+       <event kind="onLoad">
+               <movie src="lines.xml" />
+               <post delay="5" target="pathsMovie" />
+               <post delay="10" target="textMovie" />
+               <post delay="15" target="bitmapMovie" />
+               <dump />
+       </event>
+</screenplay>
diff --git a/animations/paths#1.xml b/animations/paths#1.xml
new file mode 100644 (file)
index 0000000..7e14f92
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<screenplay xmlns="urn:screenplay">
+       <array id="colors" 
+               values="[yellow,blue,green,red,orange,cyan,magenta,lime,navy,olive]" />
+       <path id="path">
+               <moveTo x="20" y="20" />
+               <lineTo x="20" y="80" />
+               <quadTo id="quad" x1="80" y1="80" x2="80" y2="20" />
+               <close />
+       </path>
+
+       <event kind="onLoad">
+               <matrix id="initialMatrix" translate="[120,150]" />
+               <paint  id="pathPaint" antiAlias="true">
+                       <color color="lightpink" />
+               </paint>
+               <apply  >
+                       <paint />
+                       <set begin="3" field="linearText" to="false" />
+               </apply>
+               <apply scope="path" >
+                       <animate target="quad" field="x1" from="10" to="120" dur="1"/>
+                       <animate target="quad" field="y1" from="10" to="120" dur="1"/>
+               </apply>
+               <apply id="apply" mode="immediate" steps="colors.length-1" >
+                       <group id="newPath">
+                               <matrix rotate="360/colors.length" />
+                               <paint >
+                                       <color id="color" />
+                               </paint>
+                               <add use="path" />
+                       </group>
+                       <set target="color" field="color" to="colors[apply.step]" />
+                       <set target="color" field="alpha" to=".5" />
+               </apply>
+               <post target="addCaptionFade" delay="1" />
+               <post target="addLineCaption" delay="1" />
+               <post target="scaleInitial" delay="2" />
+       </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="Paths" x="10" y="145" />
+       </event>
+
+       <event kind="user" id="scaleInitial" >
+               <apply scope="pathPaint" >
+                       <set field="linearText" to="true" />
+               </apply>
+               <apply scope="initialMatrix" >
+                       <animate field="scale" from="1" to=".5" dur="1"/>
+                       <animate field="translateX" from="120" to="60" dur="1"/>
+                       <animate field="translateY" from="150" to="180" dur="1"/>
+               </apply>
+       </event>
+       
+</screenplay>
diff --git a/animations/redcross#1.jpg b/animations/redcross#1.jpg
new file mode 100644 (file)
index 0000000..0bbae04
Binary files /dev/null and b/animations/redcross#1.jpg differ
diff --git a/animations/text#1.xml b/animations/text#1.xml
new file mode 100644 (file)
index 0000000..5a279b6
--- /dev/null
@@ -0,0 +1,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>