blob: 7d9da00082f7dbd7f5d6f63d3b5f008a325ffad8 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
margin-bottom: -4px;
}
.parent {
y: 30px;
}
.target {
fill: black;
y: 10px;
}
.expected {
fill: green;
}
</style>
<body>
<template id="target-template">
<svg width="400" height="20">
<rect x="0" width="400" height="20" class="target"/>
</svg>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'y',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.3, is: '7px'},
{at: 0, is: '10px'},
{at: 0.3, is: '13px'},
{at: 0.6, is: '16px'},
{at: 1, is: '20px'},
{at: 1.5, is: '25px'},
]);
assertInterpolation({
property: 'y',
from: 'initial',
to: '20px',
}, [
{at: -0.3, is: '-6px'},
{at: 0, is: '0px'},
{at: 0.3, is: '6px'},
{at: 0.6, is: '12px'},
{at: 1, is: '20px'},
{at: 1.5, is: '30px'},
]);
assertInterpolation({
property: 'y',
from: 'unset',
to: '20px',
}, [
{at: -0.3, is: '-6px'},
{at: 0, is: '0px'},
{at: 0.3, is: '6px'},
{at: 0.6, is: '12px'},
{at: 1, is: '20px'},
{at: 1.5, is: '30px'},
]);
assertInterpolation({
property: 'y',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, is: '33px'},
{at: 0, is: '30px'},
{at: 0.3, is: '27px'},
{at: 0.6, is: '24px'},
{at: 1, is: '20px'},
{at: 1.5, is: '15px'},
]);
assertInterpolation({
property: 'y',
from: '0px',
to: '20px'
}, [
{at: -0.3, is: '-6px'},
{at: 0, is: '0px'},
{at: 0.3, is: '6px'},
{at: 0.6, is: '12px'},
{at: 1, is: '20px'},
{at: 1.5, is: '30px'},
]);
assertInterpolation({
property: 'y',
from: '0px',
to: '10em'
}, [
{at: -0.3, is: '-3em'},
{at: 0, is: '0em'},
{at: 0.3, is: '3em'},
{at: 0.6, is: '6em'},
{at: 1, is: '10em'},
{at: 1.5, is: '15em'},
]);
assertInterpolation({
property: 'y',
from: '30px',
to: '10em'
}, [
{at: -0.3, is: '-9px'},
{at: 0, is: '30px'},
{at: 0.3, is: '69px'},
{at: 0.6, is: '108px'},
{at: 1, is: '10em'},
{at: 1.5, is: '225px'},
]);
assertInterpolation({
property: 'y',
from: '10em',
to: '0px'
}, [
{at: -0.3, is: '13em'},
{at: 0, is: '10em'},
{at: 0.3, is: '7em'},
{at: 0.6, is: '4em'},
{at: 1, is: '0em'},
{at: 1.5, is: '-5em'},
]);
assertInterpolation({
property: 'y',
from: '10em',
to: '30px'
}, [
{at: -0.3, is: '199px'},
{at: 0, is: '10em'},
{at: 0.3, is: '121px'},
{at: 0.6, is: '82px'},
{at: 1, is: '30px'},
{at: 1.5, is: '-35px'},
]);
assertInterpolation({
property: 'y',
from: '0',
to: '20'
}, [
{at: -0.3, is: '-6'},
{at: 0, is: '0'},
{at: 0.3, is: '6'},
{at: 0.6, is: '12'},
{at: 1, is: '20'},
{at: 1.5, is: '30'},
]);
</script>
</body>