Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
  <h2>Controlling GSAP Tweens</h2>
  <div class="example">
    <button class="example__button" id="playButton">Play</button> 
    <button class="example__button" id="pauseButton">Pause</button>
    <button class="example__button" id="reverseButton">Reverse</button>
    <button class="example__button" id="restartButton">Restart</button>
    <button class="example__button" id="resumeButton">Resume</button>
    <img src="" alt="Alice" class="example__element" />


                $main-color: #8e618a;

* {
  box-sizing: border-box;

*:after {
  box-sizing: inherit;

body {
  width: 100%;
  height: 100%;
  background-color: $main-color;
  line-height: 1.5;

img {
  max-width: 100%;
  height: auto;
  display: block;

.container {
  width: 100%;
  margin: 0 auto 5%;
  padding: 1em 0;
  font-size: 1.5rem;
  text-align: center;
  background-color: $main-color;

  h2 {
    color: white;
    font-size: 1.6rem;

.example {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0.5em 1.5em;
  border: 2px solid darken($main-color, 10);

.example__button {
  display: inline-block;
  margin: 0 0.2em 0.5em;
  padding: 0.5em;
  border: none;
  outline: 3px solid darken($main-color, 10);
  appearance: none;
  border-radius: 20px;
  background-color: transparent;
  color: #efefef;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color, 0.3s;
  &:focus {
    background-color: darken($main-color, 10);
    color: white;
    outline: none;

.example__element {
  width: 150px;
  height: 180px;
  border-radius: 50%;
  box-shadow: 1px 3px 0px rgba(0,0,0, 0.5);


const container = document.querySelector('.container'),
      playButton = document.querySelector('#playButton'),
      pauseButton = document.querySelector('#pauseButton'),
      reverseButton = document.querySelector('#reverseButton'),
      restartButton = document.querySelector('#restartButton'),
      resumeButton = document.querySelector('#resumeButton'),
      exampleElement= document.querySelector('.example__element');

//apply a perspective to the PARENT element (the container) to make the perspective apply to all child elements (typically best when using 3D transforms)
//again, notice the use of the set() method
TweenMax.set(container, {perspective:1000});

//cache tween in a variable and pause it
//on page load
const myCoolTween =, 5, {
  rotationY: 180,
  scaleX: 0.8,
  z: -500,
  paused: true

//handlers to control play, pause,reverse, restart, and resume
playButton.addEventListener('click', function() {;

pauseButton.addEventListener('click', function() {

reverseButton.addEventListener('click', function() {

restartButton.addEventListener('click', function() {

resumeButton.addEventListener('click', function() {