CKTIS / CSS
CSS svojstvo `interpolate-size`
`interpolate-size` određuje smije li animacija veličine interpolirati brojčanu veličinu s unutarnjom ključnom riječi poput max-content.
Verzija: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Sintaksa
numeric-only | allow-keywordsinterpolate-size određuje smije li animacija veličine interpolirati brojčanu veličinu s unutarnjom ključnom riječi poput max-content.
Primjer animira širinu od 0 px do max-content, zaustavlja se na polovici i mjeri srednju i punu širinu.
Početna vrijednost je numeric-only; svojstvo se nasljeđuje. Uz to, postoci se ne primjenjuju, a način interpolacije određuje modul.
allow-keywords ne omogućuje proizvoljnu interpolaciju dviju unutarnjih riječi; jedan kraj mora biti brojčano interpolabilan. Svojstvo se nasljeđuje.
Primjeri
<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
const probe = document.querySelector(".probe");
probe.textContent = "intrinsic width sample";
probe.style.cssText = "display:inline-block;white-space:nowrap;interpolate-size:allow-keywords;width:max-content";
const full = Math.round(probe.getBoundingClientRect().width);
const animation = probe.animate([{width:"0px"},{width:"max-content"}],{duration:1000,fill:"both"});
animation.pause();
animation.currentTime = 500;
const half = Math.round(probe.getBoundingClientRect().width);
document.querySelector("#result").textContent = "computed=" + getComputedStyle(probe).interpolateSize + "; width=" + half + "/" + full;
</script></body></html>Rezultat
computed=allow-keywords; width=71/142
Primjer je izveden lokalno u izoliranoj Chrome sesiji bez mreže; rezultat dolazi iz preglednikovog CSS API-ja.