mirror of
https://github.com/servo/servo.git
synced 2025-07-01 20:43:39 +01:00
72 lines
2.2 KiB
HTML
72 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>offset-position interpolation</title>
|
|
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
|
|
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-position-property">
|
|
<meta name="assert" content="offset-position supports <position> animation.">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="resources/interpolation-testcommon.js"></script>
|
|
<style>
|
|
body {
|
|
width: 500px;
|
|
height: 500px;
|
|
transform: rotate(0deg);
|
|
}
|
|
div {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
test_interpolation({
|
|
property: 'offset-position',
|
|
from: '220px 240px',
|
|
to: '300px 400px',
|
|
}, [
|
|
{at: -1, expect: '140px 80px'},
|
|
{at: 0, expect: '220px 240px'},
|
|
{at: 0.125, expect: '230px 260px'},
|
|
{at: 0.875, expect: '290px 380px'},
|
|
{at: 1, expect: '300px 400px'},
|
|
{at: 2, expect: '380px 560px'}
|
|
]);
|
|
|
|
test_interpolation({
|
|
property: 'offset-position',
|
|
from: 'left 480px top 400px',
|
|
to: 'right -140% bottom -60%',
|
|
}, [
|
|
{at: -1, expect: 'calc(960px - 240%) calc(800px - 160%)'},
|
|
{at: 0, expect: 'left 480px top 400px'},
|
|
{at: 0.125, expect: 'calc(420px + 30%) calc(350px + 20%)'},
|
|
{at: 0.875, expect: 'calc(210% + 60px) calc(140% + 50px)'},
|
|
{at: 1, expect: 'right -140% bottom -60%'},
|
|
{at: 2, expect: 'calc(480% - 480px) calc(320% - 400px)'}
|
|
]);
|
|
|
|
test_interpolation({
|
|
property: 'offset-position',
|
|
from: 'left top',
|
|
to: 'left 8px bottom 20%',
|
|
}, [
|
|
{at: -1, expect: '-8px -80%'},
|
|
{at: 0, expect: 'left top'},
|
|
{at: 0.125, expect: '1px 10%'},
|
|
{at: 0.875, expect: '7px 70%'},
|
|
{at: 1, expect: 'left 8px bottom 20%'},
|
|
{at: 2, expect: '16px 160%'}
|
|
]);
|
|
|
|
test_no_interpolation({
|
|
property: 'offset-position',
|
|
from: 'right 10px top 20%',
|
|
to: 'auto'
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|