Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // globals are bad
- var someGlobalStop = false;
- function createAnimateFunction(randMax, moveMin, duration) {
- var __animate = function (){
- var rnd = Math.ceil(Math.random() * randMax) + moveMin,
- rnd2 = Math.ceil(Math.random() * randMax) + moveMin,
- props = {
- marginBottom: rnd,
- marginTop: rnd,
- marginLeft:rnd2,
- marginRight: rnd2
- };
- if(! someGlobalStop) {
- $(this).animate(props, duration, __animate);
- }
- };
- return __animate;
- }
- function animatesmall(){
- $('ul.work li.small').each(createAnimateFunction(30, 10, 900));
- }
- function animatemedium(){
- $('ul.work li.medium').each(createAnimateFunction(50, 20, 1900));
- }
- function animatelarge(){
- $('ul.work li.large').each(createAnimateFunction(50, 30, 2300));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement