Parallel Tween

In this example below you will see how to do a Parallel Tween with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by friendlygiraffe, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright friendlygiraffe ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Parallel Tween</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  
<div id="square"></div>
<div id="circle"></div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.4/TweenMax.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/friendlygiraffe/parallel-tween-KgvggK */
body {
  background-color: black;
}

#square {
    position: absolute;
    width: 100px;
    height: 100px;
    background-color: blue;
}
#circle {
    position: absolute;
    width: 100px;
    height: 100px;
    background-color: red;
    border-radius: 50%;
}

/*Downloaded from https://www.codeseek.co/friendlygiraffe/parallel-tween-KgvggK */
TweenLite.defaultEase = Power0.easeNone;

var tl = new TimelineMax({repeat:-1, repeatDelay:1});

tl.to("#square", 6, {scale:2})
.to("#circle", 1, {x:400})
.to("#circle", 1, {y:30})
.to("#circle", 1, {x:0})
.to("#circle", 1, {y:0})

Comments