blob: a2c8e90a823c76eea40e58d338abf4fbb13def62 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
display: inline-block;
}
.parent {
cy: 100px;
}
.target {
font-size: 16px;
cy: 50px;
}
.expected {
fill: green;
}
</style>
<body>
<template id="target-template">
<svg height="200" width="20">
<circle cx="50%" cy="50%" r="10" class="target">
</svg>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'cy',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.25, is: '57.5px'},
{at: 0, is: '50px'},
{at: 0.25, is: '42.5px'},
{at: 0.5, is: '35px'},
{at: 0.75, is: '27.5px'},
{at: 1, is: '20px'},
{at: 1.25, is: '12.5px'},
]);
assertInterpolation({
property: 'cy',
from: 'initial',
to: '20px',
}, [
{at: -0.25, is: '-5px'},
{at: 0, is: '0px'},
{at: 0.25, is: '5px'},
{at: 0.5, is: '10px'},
{at: 0.75, is: '15px'},
{at: 1, is: '20px'},
{at: 1.25, is: '25px'},
]);
assertInterpolation({
property: 'cy',
from: 'inherit',
to: '20px',
}, [
{at: -0.25, is: '120px'},
{at: 0, is: '100px'},
{at: 0.25, is: '80px'},
{at: 0.5, is: '60px'},
{at: 0.75, is: '40px'},
{at: 1, is: '20px'},
{at: 1.25, is: '0px'},
]);
assertInterpolation({
property: 'cy',
from: 'unset',
to: '20px',
}, [
{at: -0.25, is: '-5px'},
{at: 0, is: '0px'},
{at: 0.25, is: '5px'},
{at: 0.5, is: '10px'},
{at: 0.75, is: '15px'},
{at: 1, is: '20px'},
{at: 1.25, is: '25px'},
]);
assertInterpolation({
property: 'cy',
from: '-10px',
to: '10px',
}, [
{at: -0.25, is: '-15px'},
{at: 0, is: '-10px'},
{at: 0.25, is: '-5px'},
{at: 0.5, is: '0px'},
{at: 0.75, is: '5px'},
{at: 1, is: '10px'},
{at: 1.25, is: '15px'},
]);
assertInterpolation({
property: 'cy',
from: '-20px',
to: '30em',
}, [
{at: -0.25, is: '-145px'},
{at: 0, is: '-20px'},
{at: 0.25, is: '105px'},
{at: 0.5, is: '230px'},
{at: 0.75, is: '355px'},
{at: 1, is: '30em'},
{at: 1.25, is: '605px'},
]);
assertInterpolation({
property: 'cy',
from: 'inherit',
to: '140px',
}, [
{at: -0.25, is: '90px'},
{at: 0, is: '100px'},
{at: 0.25, is: '110px'},
{at: 0.5, is: '120px'},
{at: 0.75, is: '130px'},
{at: 1, is: '140px'},
{at: 1.25, is: '150px'},
]);
assertInterpolation({
property: 'cy',
from: '-10',
to: '10',
}, [
{at: -0.25, is: '-15'},
{at: 0, is: '-10'},
{at: 0.25, is: '-5'},
{at: 0.5, is: '0'},
{at: 0.75, is: '5'},
{at: 1, is: '10'},
{at: 1.25, is: '15'},
]);
</script>
</body>