Hover Animation : Animation Action « Ajax Layer « JavaScript DHTML






Hover Animation

 

http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999


<html>
<head>
<title>DynAPI Examples - Hover Animation</title>
<script language="Javascript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('./dynapisrc/');
dynapi.library.include('dynapi.api');
dynapi.library.include('dynapi.fx.Thread');
//dynapi.library.include('dynapi.util.pathanim.js');  // hover requires a function in pathanim
dynapi.library.include('dynapi.fx.HoverAnimation');
</script>
<script language="Javascript">

dynapi.onLoad (function() {
  block = new DynLayer();
  block.setSize(20,20);
  block.setLocation(200,200);
  block.setBgColor("red");

  hover = new HoverAnimation(block);
  hover.setAmplitude(50);
  hover.setAngleIncrement(10);
  hover.sleep(20);

  hover.playAnimation();

  var listener = {
    onpathstart : function(e) {
      status = "start";
    },
    onpathrun : function(e) {
      var o = e.getSource();
      status = "play "+o.x+" "+o.y;
    },
    onpathstop : function(e) {
      var o = e.getSource();
      status = "stop "+o.x+" "+o.y;;
    }
  }
  block.addEventListener(listener);
  dynapi.document.addChild(block);
});

//-->
</script>
</head>

<body bgcolor="#ffffff">

<p>Hover
<br>amplitude: <a href="javascript:hover.setAmplitude(50)">50</a> | <a href="javascript:hover.setAmplitude(100)">100</a>
<br>angle increment: <a href="javascript:hover.setAngleIncrement(10)">10</a> | <a href="javascript:hover.setAngleIncrement(5)">5</a>
<br>sleep: <a href="javascript:hover.sleep(20)">20</a> | <a href="javascript:hover.sleep(40)">40</a>

</body>
</html>

           
         
  








dynapi.zip( 791 k)

Related examples in the same category

1.Collison animation
2.Swiper Animation
3.Jtween animation