GSAP Spinning Ticket

In this example below you will see how to do a GSAP Spinning Ticket with some HTML / CSS and Javascript

Simple spinning element as if it were hanging from a tree.

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


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

  <meta charset="UTF-8">
  <title>GSAP Spinning Ticket</title>
      <link rel="stylesheet" href="css/style.css">



  <link href='' rel='stylesheet' type='text/css'>

<div id="wrap">
  <div id="wish">
      <p>&emsp;&emsp;&emsp;Merry Christmas!</p>
  <script src=''></script>
<script src=''></script>
<script src=''></script>


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



/*Downloaded from */
* {
  box-sizing: border-box;
body {
  font-family: 'Meddon', cursive;
  background: #F8F8F8;
  -webkit-font-smoothing: antialiased;
#wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  margin: -200px 0 0 -200px;
  width: 400px;
  height: 400px;
  border-radius: 200px;
  background: #89B650;
#wrap:after {
  position: absolute;
  top: 0;
  left: 200px;
  display: block;
  width: 1px;
  height: 200px;
  content: "";
  background: white;
#wish {
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -50px 0 0 -100px;
  width: 200px;
  height: 100px;
  border-radius: 0 50px 50px 0;
  background: white;
  font-size: 1.2em;
  line-height: 1.8;
  text-align: left;
  -webkit-transform: rotate(-90deg);
          transform: rotate(-90deg);
#wish p {
  padding: 16px 0 0 20px;
  margin: 0;
#wish:before {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  display: block;
  margin: -10px 0 0 0;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #89B650;

/*Downloaded from */
var container = $("#wrap"),
    ticket = $("#wish"),
    text = $("#wish p");

var tl = new TimelineMax();

tl.set(container, {perspective:400});
tl.set(text, {
  transformStyle: "preserve-3d"

tl.from(ticket, 6, {
  ease: Power2.easeInOut,
  repeat: -1,
  repeatDelay: 1,
  transformStyle: "preserve-3d",
  yoyo: true