Change name variable and let it fly.
Created
September 6, 2013 07:36
-
-
Save nladart/6460693 to your computer and use it in GitHub Desktop.
A Pen by hakanersu.
This file contains hidden or 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
<div class="tasiyici"> | |
</div> |
This file contains hidden or 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
var name ="Hakan ERSU", | |
nameArr =name.split(''), | |
arrayLength=nameArr.length, | |
containerWidth=$('.tasiyici').width(), | |
fontSizeMax=64, | |
containerHeight=$('.tasiyici').height(); | |
function getRandomInt (min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function revealMe(){ | |
var numberOfRealMe = $('.realme').length; | |
$("<span>",{ | |
'class':'realme harf' | |
}).appendTo('.tasiyici').html(nameArr[0]).css({ | |
left:numberOfRealMe*60, | |
'font-size':64 | |
}).animate({ | |
bottom:200 | |
},function(){ | |
//nameArr.remove(nameArr[0]); | |
nameArr.shift(); | |
}); | |
} | |
function randomLetters(){ | |
console.log('started'); | |
$.each(nameArr,function(key,value){ | |
$("<span>", { | |
'class':'harf' | |
}).appendTo('.tasiyici').html(value).css({ | |
left:getRandomInt(0,containerWidth), | |
fontSize:getRandomInt(12,fontSizeMax) | |
}).animate({ | |
bottom:getRandomInt(600,containerHeight) | |
},getRandomInt(600,1600),function(){ | |
$(this).animate({ | |
opacity:0 | |
},100,function(){ $(this).remove();}); | |
}); | |
}); | |
} | |
setInterval(function(){ | |
randomLetters(); | |
},600); | |
setInterval(function(){ | |
revealMe(); | |
},3000); |
This file contains hidden or 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
.tasiyici { | |
width:600px; | |
height:400px; | |
display:block; | |
position:relative; | |
overflow:hidden; | |
} | |
.harf{ | |
position:absolute; | |
bottom:-40px; | |
left:0; | |
color:#666; | |
font-family: Arial; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment