Skip to content

Instantly share code, notes, and snippets.

@Ahrengot
Created July 4, 2012 11:04
Show Gist options
  • Save Ahrengot/3046767 to your computer and use it in GitHub Desktop.
Save Ahrengot/3046767 to your computer and use it in GitHub Desktop.
Simple "pump" animation using a Greensock timeline ... Pump it!
// Pump it!
(function() {
var $el = $('#logo'), // <-- Change to whatever
canPump = true,
pumpTL = new TimelineLite({
paused: true,
onStart: function() { canPump = false; },
onComplete: function() { canPump = true; }
});
pumpTL.to($el, 0.08, {css:{scale: 1.03}});
pumpTL.to($el, 0.18, {css:{scale: 1}});
pumpTL.to($el, 0.1, {css:{scale: 1.05}});
pumpTL.to($el, 0.4, {css:{scale: 1}});
$el.on('mouseenter', function() {
if (!canPump) return;
pumpTL.restart();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment