blob: 0da4ecd3f5e2eeb5532c9727c975cd44aeb06b4f [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
border-radius: 30px;
}
.target {
width: 80px;
height: 80px;
display: inline-block;
background-color: black;
margin-right: 5px;
border-radius: 10px;
}
.expected {
background-color: green;
margin-right: 15px;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'border-radius',
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: 'border-radius',
from: 'initial',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{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: 'border-radius',
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: 'border-radius',
from: 'unset',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{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: 'border-radius',
from: '10px',
to: '50px'
}, [
{at: -0.3, is: '0px'}, // CSS border-radius can't be negative.
{at: 0, is: '10px'},
{at: 0.3, is: '22px'},
{at: 0.6, is: '34px'},
{at: 1, is: '50px'},
{at: 1.5, is: '70px'},
]);
assertInterpolation({
property: 'border-radius',
from: '10px',
to: '100%'
}, [
// These expectations are expected to fail on the current animation engine
// with different (but equivalent) calc expressions.
{at: -0.3, is: 'calc(13px + -30%)'},
{at: 0, is: '10px'},
{at: 0.3, is: 'calc(7px + 30%)'},
{at: 0.6, is: 'calc(4px + 60%)'},
{at: 1, is: '100%'},
{at: 1.5, is: 'calc(-5px + 150%)'},
]);
</script>
</body>