MooTools - Sine Transition



This displays a sineousidal transition with in, out, and in-out events. Let us take an example wherein, we add a mouse down event to a div element along with sineousidal events. Take a look at the following code.

Example

<!DOCTYPE html>
<html>

   <head>
      <style>
         #sine_in {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #sine_out {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #sine_in-out {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
      </style>
      
      <script type = "text/javascript" src = "MooTools-Core-1.6.0.js"></script>
      <script type = "text/javascript" src = "MooTools-More-1.6.0.js"></script>
      
      <script type = "text/javascript">
         window.addEvent('domready', function() {
            $('sine_in').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'sine:in'});
               this.tween('width', [80, 400]);
            });
            
            $('sine_out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'sine:out'});
               this.tween('width', [80, 400]);
            });
            
            $('sine_in-out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'sine:in-out'});
               this.tween('width', [80, 400]);
            });
         });
      </script>
   </head>
   
   <body>
      <div id = "sine_in"> Sine : in</div><br/>
      <div id = "sine_out"> Sine : out</div><br/>
      <div id = "sine_in-out"> Sine : in-out</div><br/>
   </body>
   
</html>

You will receive the following output −

Output

mootools_fxoptions.htm
Advertisements