Skip to content
Browse files

now removes extra br elements from display and uses webkitTransitione…

…nd events

Signed-off-by: Scott Cheezem <scott.cheezem@gmail.com>
  • Loading branch information...
1 parent dae9023 commit 7a3c28aa2ae39aecd1869d6d0aa24aa062856914 @scottCheezem committed
Showing with 15 additions and 25 deletions.
  1. +15 −25 index.html
View
40 index.html
@@ -414,39 +414,25 @@
}
-function fallDown(htmlObj){
+
+
+function fallDown(htmlObj, callback){
M=1000;
N=2000;
randomTime = Math.floor(M + (1+N-M)*Math.random()) // num is random integer from M to N M<N
+ //randomTime = 5000;
htmlObj[0].style.webkitTransition = "all "+randomTime+" ms";
htmlObj[0].style.webkitTransform = "translateY("+parseInt(500)+"px)";
htmlObj[0].style.opacity = 0;
+ htmlObj[0].addEventListener('webkitTransitionEnd', function(e){htmlObj.remove()});
- //hmmm…how to remove the object from the DOM AFTER the animation coolness is complete?
- //htmlObj.remove();
-
- //setTimeout(fallUp(), 5000);
-}
-
-//this assumes fallDwon and clear.exe() have already been called...
-function fallUp(){
- console.log("falling up");
- for (var c=0 ; c<$('.charSpace').size() ; c++){
- console.log($('.charSpace')[c]);
- $('.charSpace')[c].style.webkitTransform = "";
- $('.charSpace')[c].style.opacity= 1;
-
- }
- //clear.exe();
-
}
-
function makeAllCharSpaces(){
$('.command').each(function(e){
@@ -508,11 +494,11 @@
fadeIn = true;
$('#screen').scroll(function(e){
- console.log($('#background')[0].style.opacity);
- console.log('scroll happens');
+ //console.log($('#background')[0].style.opacity);
+ //console.log('scroll happens');
if(fadeIn){
$('#background')[0].style.opacity = parseFloat($('#background')[0].style.opacity)+.001
- console.log($('#background')[0].style.opacity);
+ //console.log($('#background')[0].style.opacity);
if($('#background')[0].style.opacity >= 1){
fadeIn = false;
}
@@ -520,7 +506,7 @@
}else{
$('#background')[0].style.opacity =parseFloat($('#background')[0].style.opacity)-.001;
- console.log($('#background')[0].style.opacity);
+ //console.log($('#background')[0].style.opacity);
if($('#background')[0].style.opacity <= 0){
fadeIn = true;
}
@@ -528,7 +514,10 @@
}
-
+ if( $('#display > :first').is('br') ){
+
+ $('#display > br:first').remove();
+ }
$('#display').children().each(function(){
//this is cool cause it remove <p> as they come by…but it also needs to deal with <br> which is hard to do without removin them all...
if($(this).offset().top + $(this).height() < 0){
@@ -536,7 +525,8 @@
fallDown($(this));
- //$(this).remove()
+
+
//make a sweet animation happen here where this get launched in to the horrizon
//also…make it so new characters coming in get launched from

0 comments on commit 7a3c28a

Please sign in to comment.
Something went wrong with that request. Please try again.