chromium/third_party/blink/web_tests/animations/interpolation/webkit-clip-path-interpolation.html

<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
  -webkit-clip-path: inset(10px);
  padding: 10px;
}
.target {
  display: inline-block;
  width: 100px;
  height: 100px;
  background-color: black;
  -webkit-clip-path: inset(10px);
}
.expected {
  background-color: green;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
  property: '-webkit-clip-path',
  from: neutralKeyframe,
  to: 'inset(20px)',
}, [
  {at: -0.3, is: 'inset(7px)'},
  {at: 0, is: 'inset(10px)'},
  {at: 0.3, is: 'inset(13px)'},
  {at: 0.6, is: 'inset(16px)'},
  {at: 1, is: 'inset(20px)'},
  {at: 1.5, is: 'inset(25px)'},
]);

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'initial',
  to: 'inset(20px)',
});

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'inherit',
  to: 'inset(20px)',
}, [
  {at: -0.3, is: 'inset(7px)'},
  {at: 0, is: 'inset(10px)'},
  {at: 0.3, is: 'inset(13px)'},
  {at: 0.6, is: 'inset(16px)'},
  {at: 1, is: 'inset(20px)'},
  {at: 1.5, is: 'inset(25px)'},
]);

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'unset',
  to: 'inset(20px)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'none',
  to: 'circle(3px at 1px 2px)',
});

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'circle(10px at 25px 75%)',
  to: 'circle(50px at 50px center)'
}, [
  {at: -0.3, is: 'circle(0px at 17.5px 82.5%)'}, // radius can't be negative
  {at: 0, is: 'circle(10px at 25px 75%)'},
  {at: 0.3, is: 'circle(22px at 32.5px 67.5%)'},
  {at: 0.6, is: 'circle(34px at 40px 60%)'},
  {at: 1, is: 'circle(50px at 50px 50%)'},
  {at: 1.5, is: 'circle(70px at 62.5px 37.5%)'},
]);

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'circle(farthest-side at 25px 75%)',
  to: 'circle(farthest-side at 50px center)'
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'circle(closest-side at 10px 20px)',
  to: 'circle(farthest-side at 30px 40px)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'circle(50px at 10px 20px)',
  to: 'circle(farthest-side at 30px 40px)',
});

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'ellipse(10px 20px at 25px 75px)',
  to: 'ellipse(50px 100px at 50px 50px)',
}, [
  {at: -0.3, is: 'ellipse(0px 0px at 17.5px 82.5px)'}, // radius can't be negative
  {at: 0, is: 'ellipse(10px 20px at 25px 75px)'},
  {at: 0.3, is: 'ellipse(22px 44px at 32.5px 67.5px)'},
  {at: 0.6, is: 'ellipse(34px 68px at 40px 60px)'},
  {at: 1, is: 'ellipse(50px 100px at 50px 50px)'},
  {at: 1.5, is: 'ellipse(70px 140px at 62.5px 37.5px)'},
]);

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'ellipse(closest-side farthest-side at 25px 75%)',
  to: 'ellipse(closest-side farthest-side at 50px center)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'ellipse(closest-side farthest-side at 10px 20px)',
  to: 'ellipse(farthest-side closest-side at 30px 40px)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'ellipse(50px closest-side at 10px 20px)',
  to: 'ellipse(150px farthest-side at 30px 40px)',
});

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'inset(20px)',
  to: 'inset(40%)',
}, [
  {at: -0.3, is: 'inset(calc(26px + -12%))'},
  {at: 0, is: 'inset(calc(20px + 0%))'},
  {at: 0.3, is: 'inset(calc(14px + 12%))'},
  {at: 0.6, is: 'inset(calc(8px + 24%))'},
  {at: 1, is: 'inset(40%)'},
  {at: 1.5, is: 'inset(calc(-10px + 60%))'},
]);

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'inset(1px 2px 3px 4px round 10px 20px 30px 40px / 50px 60px 70px 80px)',
  to: 'inset(101px 102px 103px 104px round 110px 120px 130px 140px / 150px 160px 170px 180px)',
}, [
  {at: -0.3, is: 'inset(-29px -28px -27px -26px round 0px 0px 0px 10px / 20px 30px 40px 50px)'},
  {at: 0, is: 'inset(1px 2px 3px 4px round 10px 20px 30px 40px / 50px 60px 70px 80px)'},
  {at: 0.3, is: 'inset(31px 32px 33px 34px round 40px 50px 60px 70px / 80px 90px 100px 110px)'},
  {at: 0.6, is: 'inset(61px 62px 63px 64px round 70px 80px 90px 100px / 110px 120px 130px 140px)'},
  {at: 1, is: 'inset(101px 102px 103px 104px round 110px 120px 130px 140px / 150px 160px 170px 180px)'},
  {at: 1.5, is: 'inset(151px 152px 153px 154px round 160px 170px 180px 190px / 200px 210px 220px 230px)'},
]);

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'inset(1px 2px round 100px 200px)',
  to: 'inset(101px 102px 101px 102px)',
}, [
  {at: -0.3, is: 'inset(-29px -28px round 130px 260px)'},
  {at: 0, is: 'inset(1px 2px round 100px 200px)'},
  {at: 0.3, is: 'inset(31px 32px round 70px 140px)'},
  {at: 0.6, is: 'inset(61px 62px round 40px 80px)'},
  {at: 1, is: 'inset(101px 102px)'},
  {at: 1.5, is: 'inset(151px 152px)'}, // border radius can't be negative
]);

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'polygon(10px 20%, 30px 40%)',
  to: 'polygon(110px 120%, 130px 140%)',
}, [
  {at: -0.3, is: 'polygon(-20px -10%, 0px 10%)'},
  {at: 0, is: 'polygon(10px 20%, 30px 40%)'},
  {at: 0.3, is: 'polygon(40px 50%, 60px 70%)'},
  {at: 0.6, is: 'polygon(70px 80%, 90px 100%)'},
  {at: 1, is: 'polygon(110px 120%, 130px 140%)'},
  {at: 1.5, is: 'polygon(160px 170%, 180px 190%)'},
]);

assertInterpolation({
  property: '-webkit-clip-path',
  from: 'polygon(evenodd, 10px 20px)',
  to: 'polygon(evenodd, 110px 120px)',
}, [
  {at: -0.3, is: 'polygon(evenodd, -20px -10px)'},
  {at: 0, is: 'polygon(evenodd, 10px 20px)'},
  {at: 0.3, is: 'polygon(evenodd, 40px 50px)'},
  {at: 0.6, is: 'polygon(evenodd, 70px 80px)'},
  {at: 1, is: 'polygon(evenodd, 110px 120px)'},
  {at: 1.5, is: 'polygon(evenodd, 160px 170px)'},
]);

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'polygon(evenodd, 10px 20px)',
  to: 'polygon(nonzero, 110px 120px)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'polygon(evenodd, 10px 20px)',
  to: 'polygon(110px 120px)',
});

assertNoInterpolation({
  property: '-webkit-clip-path',
  from: 'polygon(10px 20px, 30px 40px)',
  to: 'polygon(110px 120px)',
});
</script>
</body>