Jump to content
Search Community

Nico

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Nico

  1. Nico

    transform in vh units

    you can also create a small function to get viewport units like this (ES6): const vw = (coef) => window.innerWidth * (coef/100) const vh = (coef) => window.innerHeight * (coef/100) Then use it like this: TweenMax.to('.el', .25, { x: vw(10), y: vh(10) }) Beware that the value is calculated when the code is evaluated. So if you set a Timeline at page load, then resize your window, and finnaly play the Timeline, you may have incorrect values. Btw, tried this too, but it's still evaluated when the Timeline is set, not when the actual animation is triggered: TweenMax.to('.el', .25, { x() { return vw(10) }, y() { return vh(10) } }) If someone knows how to handle this... My guess is that it's not possible for performance reasons.
×
×
  • Create New...