<!DOCTYPE html> | |
<meta charset="UTF-8"> | |
<style> | |
.parent { | |
padding: 30px; | |
} | |
.target { | |
width: 1px; | |
height: 1px; | |
background-color: black; | |
display: inline-block; | |
padding: 10px; | |
} | |
.expected { | |
background-color: green; | |
margin-right: 10px; | |
} | |
</style> | |
<body> | |
<script src="resources/interpolation-test.js"></script> | |
<script> | |
assertInterpolation({ | |
property: 'padding', | |
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: 'padding', | |
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: 'padding', | |
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: 'padding', | |
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: 'padding', | |
from: '0px', | |
to: '10px' | |
}, [ | |
{at: -0.3, is: '0px'}, // CSS padding can't be negative. | |
{at: 0, is: '0px'}, | |
{at: 0.3, is: '3px'}, | |
{at: 0.6, is: '6px'}, | |
{at: 1, is: '10px'}, | |
{at: 1.5, is: '15px'} | |
]); | |
</script> | |
</body> | |