mirror of
https://github.com/PrivacyIndex/privacyindex.github.io.git
synced 2026-01-13 16:18:07 +00:00
Fix: Make ground retract downward on scroll
This commit is contained in:
10
index.html
10
index.html
@@ -366,10 +366,6 @@
|
|||||||
;(()=>{
|
;(()=>{
|
||||||
const g=document.getElementById('ground-group')
|
const g=document.getElementById('ground-group')
|
||||||
if(!g)return
|
if(!g)return
|
||||||
const max=1
|
|
||||||
const minY=-380
|
|
||||||
const base=g.transform.baseVal.consolidate()
|
|
||||||
const baseY=base?base.matrix.f:0
|
|
||||||
const ensure=()=>{
|
const ensure=()=>{
|
||||||
if(!g.transform.baseVal.numberOfItems){
|
if(!g.transform.baseVal.numberOfItems){
|
||||||
const t=g.ownerSVGElement.createSVGTransform()
|
const t=g.ownerSVGElement.createSVGTransform()
|
||||||
@@ -378,11 +374,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ensure()
|
ensure()
|
||||||
|
const baseY=g.transform.baseVal.consolidate().matrix.f||0
|
||||||
|
const totalDrop=420
|
||||||
const onScroll=()=>{
|
const onScroll=()=>{
|
||||||
const h=window.innerHeight||1
|
const h=window.innerHeight||1
|
||||||
const p=Math.min(window.scrollY/h,max)
|
const p=Math.min(window.scrollY/h,1)
|
||||||
const eased=p*p
|
const eased=p*p
|
||||||
const y=baseY+minY*eased
|
const y=baseY+totalDrop*eased
|
||||||
const t=g.transform.baseVal.getItem(0)
|
const t=g.transform.baseVal.getItem(0)
|
||||||
t.setTranslate(0,y)
|
t.setTranslate(0,y)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user