gecko/layout/reftests/svg/smil/transform/additive-1.svg

204 lines
7.4 KiB
XML
Raw Normal View History

<svg xmlns="http://www.w3.org/2000/svg"
class="reftest-wait"
onload="setupSnapshot(1.5)">
<script type="text/ecmascript"><![CDATA[
function setupSnapshot(timeInSeconds) {
var svg = document.documentElement;
svg.pauseAnimations();
svg.setCurrentTime(timeInSeconds);
var paths = svg.getElementsByTagName("path");
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
checkAnimVal(path, path.transform.animVal, i);
}
svg.removeAttribute("class");
}
function Transform(type, angle) {
this.type = type;
this.angle = angle;
}
function checkAnimVal(path, val, index) {
var expected = [];
switch (index) {
case 0:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
break;
case 1:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
break;
case 2:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, -90));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 180));
break;
case 3:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
break;
case 4:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
break;
case 5:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, -90));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
break;
case 6:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
break;
case 7:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_SKEWX, 20));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
break;
case 8:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_SKEWX, 20));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 45));
break;
case 9:
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_ROTATE, 90));
expected.push(new Transform(SVGTransform.SVG_TRANSFORM_TRANSLATE, 0));
break;
}
var ok = true;
if (val.numberOfItems == expected.length) {
for (var i = 0; i < val.numberOfItems; i++) {
var transform = val.getItem(i);
if (transform.type != expected[i].type ||
transform.angle != expected[i].angle) {
ok = false;
}
}
} else {
ok = false;
}
if (!ok) {
path.style.visibility = 'hidden';
}
}
]]></script>
<!-- not additive -->
<g transform="translate(50 50)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(-90)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="90" dur="1s" fill="freeze"/>
</path>
</g>
<!-- to-animation: special additive -->
<g transform="translate(150 50)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(-90)">
<animateTransform attributeName="transform"
type="rotate" to="90" dur="1s" fill="freeze"/>
</path>
</g>
<!-- by-animation: special additive -->
<g transform="translate(250 50)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(-90)">
<animateTransform attributeName="transform"
type="rotate" by="180" dur="1s" fill="freeze"/>
</path>
</g>
<!-- normal additive: same type -->
<g transform="translate(50 150)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(45)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- normal additive: different type -->
<g transform="translate(100 150)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="translate(50)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="90" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- stacked additive: same type -->
<g transform="translate(250 150)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(-90)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="90" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="rotate" from="0" to="90" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- stacked additive: different types #1 -->
<g transform="translate(0 250)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="translate(50)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- stacked additive: different types #2 -->
<g transform="translate(100 250) skewX(-20)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="skewX(20) translate(50)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- stacked additive: different types #3 -->
<g transform="translate(200 250) skewX(-20)">
<path d="M-2 50h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="skewX(20) translate(50)">
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="translate" from="0" to="30" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="translate" from="0" to="-30" dur="1s" fill="freeze"
additive="sum"/>
<animateTransform attributeName="transform"
type="rotate" from="0" to="45" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
<!-- base value with rotation around a centre -->
<g transform="translate(-50 300)">
<path d="M48 100h4v -90h4l -6 -10 -6 10h4z" fill="blue"
transform="rotate(90 50 50)">
<animateTransform attributeName="transform"
type="translate" from="0 0" to="0 -50" dur="1s" fill="freeze"
additive="sum"/>
</path>
</g>
</svg>