Web: wykres tla slownika startuje pozniej - gdy naglowek mija srodek widoku
This commit is contained in:
@@ -41,8 +41,8 @@ function ChartBackdrop() {
|
||||
const update = () => {
|
||||
const r = wrap.getBoundingClientRect();
|
||||
const vh = window.innerHeight;
|
||||
// p=0 gdy nagłówek sekcji wjeżdża, p=1 gdy jej dół opuszcza widok
|
||||
const p = reduce ? 1 : Math.min(Math.max((vh * 0.9 - r.top) / (r.height * 0.9), 0), 1);
|
||||
// p=0 gdy nagłówek mija środek widoku, p=1 przy końcu sekcji
|
||||
const p = reduce ? 1 : Math.min(Math.max((vh * 0.4 - r.top) / (r.height * 0.85), 0), 1);
|
||||
line.style.strokeDashoffset = String(len * (1 - p));
|
||||
clip.setAttribute('width', String(p * 1000));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user