MooTools - Expo 过渡



此页面显示指数过渡,使用 in、out 和 in-out 事件。让我们拿一个示例,我们向 div 元素添加一个 mouse down 事件并配合指数事件。查看以下代码。

示例

<!DOCTYPE html>
<html>

   <head>
      <style>
         #expo_in {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #expo_out {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #expo_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() {
            $('expo_in').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'expo:in'});
               this.tween('width', [80, 400]);
            });
            
            $('expo_out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'expo:out'});
               this.tween('width', [80, 400]);
            });
            
            $('expo_in-out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'expo:in-out'});
               this.tween('width', [80, 400]);
            });
         });
      </script>
   </head>
   
   <body>
      <div id = "expo_in"> Expo : in</div><br/>
      <div id = "expo_out"> Expo : out</div><br/>
      <div id = "expo_in-out"> Expo : in-out</div><br/>
   </body>
   
</html>

您将收到以下输出 −

输出

mootools_fxoptions.htm
广告