Here is an example:
function animate_photo() {
if($('img#myphoto').hasClass('bounceOutLeft')){
$('img#myphoto').removeClass('bounceOutLeft').addClass('animated bounceInLeft');
$('button#photo').html('Slide off page');
}else{
$('img#myphoto').removeClass('bounceInLeft').addClass('animated bounceOutLeft');
$('button#photo').html('Slide back onto page');
}
}
I didn't tested it so i don't guarantee it works.