Skip to content

Instantly share code, notes, and snippets.

@midu
Created February 8, 2012 19:01
Show Gist options
  • Select an option

  • Save midu/1772210 to your computer and use it in GitHub Desktop.

Select an option

Save midu/1772210 to your computer and use it in GitHub Desktop.
when I found old code that starts by "nb_lols", I have to make a gist out of it
nb_lols = 0;
midu = null;
$(document).ready(function() {
var makeP = function(color) {
p = $("<p></p>").css('color', color)
.css('display', 'inline-block')
.css('font-weight', 'bold')
.css('padding', '3px')
.css('position', 'fixed')
.css('z-index', '2')
return p;
}
var kikouLettre = function(lettre, pos, color) {
l = makeP(color)
l.html(lettre)
.css('left', pos + '%')
.css('top', '-10%')
.css('z-index', '1')
.css('font-size', (Math.floor(Math.random() * 70) + 50) + 'px')
$("body").prepend(l);
return l;
}
var removeAndAnimateAgain = function(t) {
midu = t;
t.animate({'top': '110%' }, Math.floor(Math.random() * 2000) + 1000, 'swing', function() {
$(this).css('top', '-10%')
animateLetter($(this));
});
}
var animateLetter = function(l) {
l.animate({'top': '50%'}, Math.floor(Math.random() * 2000) + 1000, 'swing', function() {
$(this).effect('bounce', {'times': 5}, 1000, function () {
removeAndAnimateAgain ($(this))
})
});
}
var kikote = function() {
kikou = [kikouLettre('N', 0, '#000000'),
kikouLettre('Y', 10, '#000000'),
kikouLettre('C', 20, '#000000'),
kikouLettre('B', 30, '#000000'),
kikouLettre('i', 40, '#000000'),
kikouLettre('g', 50, '#000000'),
kikouLettre('A', 60, '#FF2300'),
kikouLettre('p', 70, '#FF2300'),
kikouLettre('p', 80, '#FF2300'),
kikouLettre('s', 90, '#FF2300') ]
midu = kikou
for (i in kikou) {
lettre = kikou[i]
animateLetter(lettre)
}
}
$('a[name="home"]').click(function() {
kikote()
})
});
@midu
Copy link
Author

midu commented Feb 8, 2012

kikote, kikouLettre, kikou... quels beaux noms de variables :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment