MooTools - Transizione cubica
Visualizza una transizione cubica con eventi in, out e in-out. Prendiamo un esempio che aggiunge amouse downevento a un elemento div insieme a eventi cubicular. Dai un'occhiata al seguente codice.
Esempio
<!DOCTYPE html>
<html>
<head>
<style>
#cubic_in {
width: 100px;
height: 20px;
background-color: #F4D03F;
border: 2px solid #808B96;
}
#cubic_out {
width: 100px;
height: 20px;
background-color: #F4D03F;
border: 2px solid #808B96;
}
#cubic_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() {
$('cubic_in').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'cubic:in'});
this.tween('width', [80, 400]);
});
$('cubic_out').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'cubic:out'});
this.tween('width', [80, 400]);
});
$('cubic_in-out').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'cubic:in-out'});
this.tween('width', [80, 400]);
});
});
</script>
</head>
<body>
<div id = "cubic_in"> Cubic : in</div><br/>
<div id = "cubic_out"> Cubic : out</div><br/>
<div id = "cubic_in-out"> Cubic : in-out</div><br/>
</body>
</html>
Riceverai il seguente output: