JSFiddle - React, Tailwind, and code Playground
by Gegeprima
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/CSSPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenLite.min.js"></script>
<div id="demo">
<div id="logo"><img id="logo" src="http://www.royanonuevo.com/css/images/character.png"></div>
<div id="taks">
<div id="updateOutput"></div>
<div id="completeOutput"></div>
</div>
</div>
CSS
#demo {
width: 692px;
height: 100px;
background-color:darkred;
padding: 8px;
}
#logo {
position: relative;
width: 60px;
height: 100px;
}
#taks {
margin-left : 350px;
margin-top : -70px;
}
JavaScript
var logo = document.getElementById("logo"),
updateOutput = document.getElementById("updateOutput"),
completeOutput = document.getElementById("completeOutput"),
updateCount = 0;
TweenLite.to(logo, 2, {left:"280px",
onUpdate:updateHandler,
onComplete:completeHandler,
onCompleteParams:["animation complete!"]});
function updateHandler() {
updateCount++;
updateOutput.innerHTML = "onUpdate fired " + updateCount;
}
function completeHandler(message) {
completeOutput.innerHTML = "onComplete fired <br/> completeParams = " + message;
}