Last active
August 29, 2015 14:00
-
-
Save natecavanaugh/11191276 to your computer and use it in GitHub Desktop.
Carousel FX definitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A.Carousel.fx = { | |
'fade': { | |
in: { | |
opacity: '1', | |
on: { | |
start: function() { | |
this.setStyles({ | |
opacity: '0' | |
}); | |
}, | |
end: function() { | |
this.setStyles({ | |
opacity: '' | |
}); | |
} | |
} | |
}, | |
out: { | |
opacity: '0', | |
on: { | |
start: function() { | |
this.setStyles({ | |
opacity: '1' | |
}); | |
}, | |
end: function() { | |
this.setStyles({ | |
opacity: '' | |
}); | |
} | |
} | |
} | |
}, | |
'slide': function(direction){ | |
var config = { | |
in: { | |
left: 0, | |
on: { | |
end: function() { | |
this.setStyles({ | |
left: '', | |
opacity: '' | |
}); | |
}, | |
start: function() { | |
this.setStyles({ | |
left: (direction == 'prev') ? '100%' : '-100%', | |
opacity: '1' | |
}); | |
} | |
} | |
}, | |
out: { | |
left: (direction == 'prev') ? '-100%' : '100%', | |
on: { | |
start: function() { | |
this.setStyles({ | |
left: '0', | |
opacity: '1' | |
}); | |
}, | |
end: function() { | |
this.setStyles({ | |
left: '', | |
opacity: '' | |
}); | |
} | |
} | |
} | |
}; | |
return config; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Possible ways to use this: | |
AUI().use('aui-carousel', function(A) { | |
// Add your own effects | |
// useful if you were to define them in a separate module so you could reuse them in multiple places | |
A.mix(A.Carousel.fx, { | |
'pushPullSqueeze': { | |
in: {/* ... */ }, | |
out: {/* ... */ } | |
}, | |
'jumpFadeRotate': { | |
in: {/* ... */ }, | |
out: {/* ... */ } | |
} | |
}); | |
new A.Carousel({ | |
// ... | |
fx: 'jumpFadeRotate' | |
//... | |
}); | |
// Or just define them on a per-instance basis | |
new A.Carousel({ | |
fx: { | |
in: {/* ... */ }, | |
out: {/* ... */ } | |
} | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment