Jump to content
Search Community

poolboy

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by poolboy

  1. Hello,

     

    As you can see in the reduce test case, if I tween the width of a div from no value to '100vw', the new value is set to '100vw'.

    var div2 = document.getElementById('div2');
    TweenMax.set(div2, {height: '100vw', onComplete:function(){
      div2.innerHTML = div2.style.height; // 100vw
    }});
    

    But if the value was already set in css (with the same unit), then the new one is calculate in px :

    
    #div {
      height: 20vw;
    }
    var div = document.getElementById('div');
    TweenMax.set(div, {height: '100vw', onComplete:function(){
      div.innerHTML = div.style.height; // ex: 1920px
    }});
    

    Is it by design ? Can I force the value to be set in the wanted unit ?

     

    In my real world case, I tween the value this way

    TweenMax.to('.skill', 1, {height: '4vw', width: '16vw');
    

    I understand the need to use pixel for the tween calcul so I was hoping to be able to do this this way to re-set my value in viewport unit :

    TweenMax.to('.skill', 1, {height: '4vw', width: '16vw', onComplete: function(){
                TweenMax.set('.skill', {height: '4vw', width: '16vw'});
    });
    

    But as the test case shows, it doesn't seems to work this way either.

     

     

    Thanks for your time

    See the Pen BovbYq by poolboy (@poolboy) on CodePen

×
×
  • Create New...