viejo, aqui te dejo lo primero que se me ocurrio, este efecto empieza a funcionar desde que abre la pagina, asi que ya te corresponde a ti mecaniquearlo para controlarlo por botones y eso
enjoy ;)
Código HTML:
<html>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<head>
<script type="text/javascript">
var value = 0;
function anime(){
var oDiv = document.getElementById('panel');
if(oDiv.style.height == '500px'){
oDiv.style.height = '0px';
value = 0;
}
else{
value +=5;
oDiv.style.height = value+'px';
}
}
</script>
</head>
<body>
<div id="panel" style="width:500px; height:500px; background: #fc6">
</div>
<script type="text/javascript">
setInterval(anime, 20);
</script>
</body>
</html>