动画6

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.a{
			width: 600px;
			height: 400px;
			background: black;
			position: relative;
			margin: 0 auto;
			margin-top: 200px;
			overflow: hidden;
		}
		.a1{
			width: 600px;
			height: 100px;
			position: absolute;
			background: blanchedalmond;
			animation: box 5s linear /*infinite*/ forwards;
			display: none;
		}
		.a:hover .a1{
			display: block;
		}
		@-webkit-keyframes box{
			0%{
				top: -110px;
			}
			100%{
				top: 10px;
			}
		}
		</style>
		
	</head>
	<body>
		<div class="a">
			<div class="a1"></div>
		</div>
	</body>
</html>

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Pyside6是Python的一个Qt应用开发框架,它提供了丰富的图形用户界面组件和功能,包括动画效果。在Pyside6中,你可以利用其内置的Qt动画系统来创建各种动态效果,如窗口移动、部件大小调整、形状变换等。以下是一些基本的动画类型和实现方法: 1. **QPropertyAnimation**:这是一种基于属性的动画,适用于改变对象的几何属性(如位置、尺寸、透明度)或样式属性。 2. **QSequentialAnimationGroup**:可以组合多个动画,按照顺序播放,提供更复杂的动画序列。 3. **QParallelAnimationGroup**:同时播放多个动画,可以控制它们之间的同步或异步。 4. **QKeyframeAnimation**:使用关键帧定义动画的路径,允许创建更细致的动画变化。 5. **Qt对象动画**(QObject::setProperty):直接操作对象的属性,动态设置属性值实现动画。 要使用动画,你可以这样做: ```python from PySide6.QtCore import QPropertyAnimation, Qt, QEasingCurve from PySide6.QtWidgets import QApplication, QWidget class MyWidget(QWidget): def __init__(self): super().__init__() self.animation = QPropertyAnimation(self, b"pos") # 动画对象 self.animation.setDuration(2000) # 动画持续时间(毫秒) self.animation.setEasingCurve(QEasingCurve.OutCubic) # 设置缓动曲线 self.animation.start() # 开始动画 if __name__ == "__main__": app = QApplication([]) widget = MyWidget() widget.show() app.exec_() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值