I recently created a unique two-sided element that smoothly rotates around the Y axis using the powerful CSS3 transform: rotateY()
property, inspired by fantastic examples found at .
While I have successfully made it rotate on hover or at specified intervals, my current challenge is achieving continuous spinning. Below is the script I am currently working with, but I'm struggling to effectively "reset" the transform in order to create a seamless one-directional spin without the back and forth rocking motion.
setInterval(function() {
$('.hover').removeClass('reverse').addClass('flip');
setTimeout(function() {
$('.hover').removeClass('flip').addClass('reverse')
}, 1500);
}, 3000);
I'll skip over detailing the CSS as it closely resembles what's demonstrated on the example page. Nonetheless, the presence of the .reverse
class serves as a replica of .flip
, featuring specific values for transform: rotateY()
aimed at guiding it back to its initial position while maintaining a consistent direction.