Created
September 21, 2015 14:02
-
-
Save chuck0523/8bb2790f595402115a6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by CoffeeScript 1.9.3 | |
(function() { | |
$(function() { | |
var compass, diff, img, left, log, num, w; | |
log = function(x) { | |
return console.log(x); | |
}; | |
img = $('#img'); | |
w = img.prop('width'); | |
left = img.position().left; | |
compass = 1; | |
num = 0; | |
diff = 0.3; | |
return setInterval(function() { | |
num += 1; | |
if (num === 0) { | |
compass = 1; | |
} else if (num === 500) { | |
compass = -1; | |
} | |
if (compass > 0) { | |
w += diff; | |
left -= diff; | |
} else { | |
w -= diff; | |
left += diff; | |
} | |
return img.css({ | |
'left': left, | |
'width': w | |
}); | |
}, 100); | |
}); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment