cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="bubbleOne">
  <p>WOBBLY<br />BUTTON</p>
  <svg id="createStrat" viewBox="0 0 168 168">
    <g id="backdrop">
     <path id="backdrop-back" d="M165.2,84c0,22.6-9.3,42.2-24.2,57s-34.4,26-57,26s-44.1-9.2-58.9-24S1.7,106.6,1.7,84 S10.2,39.8,25,25S61.4,3,84,3s43.7,7.7,58.5,22.5S165.2,61.4,165.2,84z"/>
     </g>
  </svg>
</div>
            
          
!
            
              #backdrop-back{
  fill: #71C7F2;
  opacity: 0.75;
}

#bubbleOne {
  width:250px;
  position:absolute;
  top:70px;
  left:200px;
  cursor:pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none; /* Disable selection/copy in UIWebView */
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

#bubbleOne p{
  font-family: Arial, sans-serif;
  font-size:25px;
  line-height:26px;
  text-align:center;
  position:absolute;
  top:75px;
  width:100%;
  color:#fff;
}
            
          
!
            
              // --------  SHAKE ------------
var box1 = document.querySelectorAll("#bubbleOne")[0];

function shake(element, shakes, speed){
	var tl = new TimelineLite();
	TweenLite.set(element, {x:"+=0"}); // this creates a full _gsTransform on element
	var transforms = element._gsTransform;
	
  //store the transform values that exist before the shake so we can return to them later
  var initProps = {
  	x:transforms.x,
    y:transforms.y
  }
  
  //shake a few times
  for(var i = 0; i < shakes; i++){
		tl.to(element, speed ,{x:initProps.x + R(-4,4), y:initProps.y + R(-2,2)})
  }
  
  return tl;
};

function R(max,min){return Math.random()*(max-min)+min};

//TweenLite
var tl = new TimelineMax({repeat:-1, yoyo:true});
tl.add(shake(box1, 50, 0.11))
 
 
// ---------- ROTATE SVG ------------

/* Store components for easy reference */
var backdrop = document.getElementById('backdrop-back');
var bubble1 = document.getElementById('bubbleOne');

/* Backdrop */
TweenMax.to(backdrop, 4, {
  rotation: 360,
  svgOrigin: '84 84',
  repeat: -1,
  ease: Linear.easeNone
});


//Timeline
var makeBubbleTimeline = function (ease, reverse, duration) {
  duration = duration || 0.4;
  return new TimelineMax()
    .to(bubble1, duration, {
      opacity:0.5,
      transformOrigin:"50% 50%",
      scale:1.2,
      ease: ease
    }, 0);
};


/* bubble 1*/
var bubbleTimeline = new TimelineMax({ paused: true })
  .add(makeBubbleTimeline(Quad.easeOut))


/* play or reverse timeline */
var bub = function () {
  if (!bubbleTimeline.isActive()) {
    bubbleTimeline.restart();
  }
};

var bubdone = function () {
    bubbleTimeline.reverse();
};

//event listeners for bubble button
bubble1.addEventListener('touchstart', bub);
bubble1.addEventListener('mousedown', bub);
bubble1.addEventListener('touchend', bubdone);
bubble1.addEventListener('mouseup', bubdone);

            
          
!
999px
Loading ..................

Console