怎么才能让动画的最后一帧自然一些?
来源:3-3 编程练习
慕的地0823274
2018-10-16 22:59:36
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style> .message{ width: 360px; height:90px; background-color: #abcdef; position: absolute; top:0; right:0; bottom:0; left:0; margin:auto auto; text-align: center; line-height: 90px; font-size: 16px; font-weight: bold; transition: transform 3s ease-in-out; transform: rotate(0deg) scale(1,1); } .message:hover{ cursor: pointer; transition: transform 3s ease-in-out; transform: rotate(720deg) scale(2,2); } </style> </head> <body> <div class="message"> Hello! </div> </body> </html>
老师这是我的代码,基本上实现了功能,但是在鼠标离开元素执行旋转缩小动画的时候,最后一帧会有一个闪屏的效果,怎么才能消除,或者让动画过度的平缓一些!
1回答
是因为在放大的过程中,右侧出现了垂直方向上的滚动条,所以在缩小的过程中,滚动条没有及时减少,造成最后有一个滚动条突然消失的状态,会有闪屏的效果。可以给body设置上超出隐藏,如下:
自己可以测试下,祝学习愉快!
相似问题