JSFiddle - React, Tailwind, and code Playground

by geekambassador

HTML

<script src="http://www.greensock.com/js/src/TweenMax.min.js"></script>

JavaScript

// this object has a height() method that will get (return) _height if no param is passed in 
//or set _height if a param is passed in 
var obj1 = {
    _height: 0,
    height: function(val) {
        if (arguments.length === 0) {
            //get
            return this._height;
        } else {
            //set
            this._height = val
        }
    }
};




function showHeight() {
    console.log(obj1.height()); //gets height
}

//get starting height
console.log('starting height = ' + obj1.height());
//set height to 50        
obj1.height(50)
//verify height was set to 50    
console.log('after height(50) was set calling height() gets ' + obj1.height());
            
console.log('start tweening from 50 to 100');

TweenLite.to(obj1, .5, {
    height: 150,
    onUpdate: showHeight,
    ease: Linear.easeNone
});