3d悬停效果反向动画
我发现了这个很酷的 3D 倾斜悬停图像效果,归功于此 codepen: https://codepen.io/technokami/pen/abojmZa
我发现的唯一问题是,当您开始将鼠标悬停在其上时,动画就会开始,但是一旦您将鼠标移开,它就会立即重置到起点。这可能是一个小细节,但如果动画能够顺利恢复,那就更好了。
(例如:http://jsfiddle.net/Ugc5g/892/ 它是不一样,但描述了我的意思,通过反向动画,我想用第一个3d悬停动画codepen实现类似的反向动画,缩放并旋转回原点位置,而不仅仅是跳跃back)
/* Add listener for mouseout event, remove the rotation
TODO: add reverse animation scale and rotate back to original smoothly
*/
el.addEventListener('mouseout', function() {
el.style.transform = 'perspective(500px) scale(1) rotateX(0) rotateY(0)'
})
我尝试修复它,但找不到合适的解决方案,希望这里的CSS动画大师可以帮助我。
I found this cool 3d tilt hover image effect, credit to this codepen:
https://codepen.io/technokami/pen/abojmZa
The only problem I found, when you start to hover over it, the animation starts, but as soon as you move the mouse away, it immediately resets to its starting point. It might be a small detail, but would so much better if the animation would smoothly revert back.
(For example: http://jsfiddle.net/Ugc5g/892/ it is not the same, but describes what I mean, with reverse back the animation, I would like to achieve the similarly reverse back animation with the first 3d hover animation codepen, scale and rotate back to the origin position, not just jumping back)
/* Add listener for mouseout event, remove the rotation
TODO: add reverse animation scale and rotate back to original smoothly
*/
el.addEventListener('mouseout', function() {
el.style.transform = 'perspective(500px) scale(1) rotateX(0) rotateY(0)'
})
I tried to fix it, but could not find the proper solution for it, hope a css animation master here can help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样还是通过360来旋转?这是通过延迟它来使其平滑。
Like this or rotate back by going to 360?? this one is to smooth it back by delaying it.