blob: 5265ab54584c265fc481ae773e6185fa8edb3a86 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
transform-origin: 30px 10px;
}
.target {
display: inline-block;
margin-top: 50px;
margin-bottom: 25px;
width: 50px;
height: 50px;
background: red;
transform: scale(1.5);
transform-origin: 10px 30px;
}
.expected {
background: green;
position: relative;
left: -50px;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'transform-origin',
from: neutralKeyframe,
to: '20px 20px',
}, [
{at: -0.3, is: '7px 33px'},
{at: 0, is: '10px 30px'},
{at: 0.3, is: '13px 27px'},
{at: 0.6, is: '16px 24px'},
{at: 1, is: '20px 20px'},
{at: 1.5, is: '25px 15px'},
]);
assertInterpolation({
property: 'transform-origin',
from: 'initial',
to: '20px 20px',
}, [
{at: -0.3, is: '26.5px 26.5px'},
{at: 0, is: '25px 25px'},
{at: 0.3, is: '23.5px 23.5px'},
{at: 0.6, is: '22px 22px'},
{at: 1, is: '20px 20px'},
{at: 1.5, is: '17.5px 17.5px'},
]);
assertInterpolation({
property: 'transform-origin',
from: 'inherit',
to: '20px 20px',
}, [
{at: -0.3, is: '33px 7px'},
{at: 0, is: '30px 10px'},
{at: 0.3, is: '27px 13px'},
{at: 0.6, is: '24px 16px'},
{at: 1, is: '20px 20px'},
{at: 1.5, is: '15px 25px'},
]);
assertInterpolation({
property: 'transform-origin',
from: 'unset',
to: '20px 20px',
}, [
{at: -0.3, is: '26.5px 26.5px'},
{at: 0, is: '25px 25px'},
{at: 0.3, is: '23.5px 23.5px'},
{at: 0.6, is: '22px 22px'},
{at: 1, is: '20px 20px'},
{at: 1.5, is: '17.5px 17.5px'},
]);
assertInterpolation({
property: 'transform-origin',
from: 'top left',
to: 'bottom right',
}, [
{at: -0.3, is: '-15px -15px'},
{at: 0, is: '0px 0px'},
{at: 0.3, is: '15px 15px'},
{at: 0.6, is: '30px 30px'},
{at: 1, is: '50px 50px'},
{at: 1.5, is: '75px 75px'},
]);
assertInterpolation({
property: 'transform-origin',
from: 'center center',
to: '0% 100px',
}, [
{at: -0.3, is: '32.5px 2.5px'},
{at: 0, is: '25px 25px'},
{at: 0.3, is: '17.5px 47.5px'},
{at: 0.6, is: '10px 70px'},
{at: 1, is: '0px 100px'},
{at: 1.5, is: '-12.5px 137.5px'},
]);
assertInterpolation({
property: 'transform-origin',
from: '0% 50% 5px',
to: '100% 150% 0px'
}, [
{at: -0.3, is: '-30% 20% 6.5px'},
{at: 0, is: '0% 50% 5px'},
{at: 0.3, is: '30% 80% 3.5px'},
{at: 0.6, is: '60% 110% 2px'},
{at: 1, is: '100% 150% 0px'},
{at: 1.5, is: '150% 200% -2.5px'},
]);
</script>
</body>