Jump to content
Search Community

UnrilWever

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by UnrilWever

  1. like this And I can calculate it in Native code,but i wonder if there's anything in gsap that simplifies the code export function amplificationElementTransform(Element: HTMLElement) { const bigImg = Element; const bigElementStyle = bigImg.getBoundingClientRect(); const bodyElementStyle = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight, }; const imgCenterPosition = { x: getLeft(bigImg) + bigElementStyle.width / 2, y: getTop(bigImg) + bigElementStyle.height / 2, }; const bodyCenterPosition = { x: bodyElementStyle.width / 2, y: bodyElementStyle.height / 2 }; const scaleWidth = bodyElementStyle.width / bigElementStyle.width; const scaleHeight = bodyElementStyle.height / bigElementStyle.height; function calculateX(){ return bodyCenterPosition.x - imgCenterPosition.x; } function calculateY(){ return bodyCenterPosition.y - imgCenterPosition.y; } function calculateScale(){ return scaleWidth > scaleHeight ? scaleWidth : scaleHeight; } const x = calculateX(); const y = calculateY(); const scale = calculateScale(); return { x, y, scale }; }
  2. I may unable to give a demo,but all of your suggestion does help and good to answer my question
  3. I have a timeline probably like this tl .addLabel('1') to(...) .addLabel('2') to(...) .addLabel('3') when I call tl.tweenTo(tl.nextLabel()); The next tween must wait untill the last one was ended before it can start playing So how can i accelerate the last one ? Or I achieve it another way rather than timeline ?
×
×
  • Create New...