uniapp实现图片上下浮动效果

实现效果

图片以Y轴进行上下浮动

实现代码
html 复制代码
<template>
	<view class="header">
	
		<view class="image-center">
			<image src="../../static/image/index_center.png" class="centers"></image>
		</view>
	</view>

</template>

<script setup>

</script>

<style lang="scss" scoped>
	.header {

		.image-center {
			width: 600rpx;
			height: 400rpx;

			.centers {
				width: 100%;
				height: 100%;
				animation: float 4s ease-in-out infinite;
				/* 控制动画的速度、时间、迭代次数等 */
			}

			@keyframes float {
				0% {
					transform: translateY(0);
				}

				50% {
					transform: translateY(-40rpx);
				}

				100% {
					transform: translateY(0);
				}
			}
		}


	}
</style>
相关推荐
kyriewen1 分钟前
别再滥用 iframe 了!这些场景下它其实是最优解
前端·javascript·html
Nile2 分钟前
解密openclaw底层pi-mono架构系列一:5. pi-web-ui
前端·ui·架构
郝学胜-神的一滴11 分钟前
系统设计与面向对象设计:两大设计思想的深度剖析
java·前端·c++·ue5·软件工程
徐同保15 分钟前
openclaw插件
前端
摸鱼仙人~16 分钟前
前端面试最常考、最容易被问崩的 50 道八股精简版
前端·面试·职场和发展
恪愚25 分钟前
three | 材质 Material
前端·javascript·材质
zuoerjinshu28 分钟前
WebSpoon9.0(KETTLE的WEB版本)编译 + tomcatdocker部署 + 远程调试教程
前端
lxmyzzs41 分钟前
解决Windows安装OpenClaw报错:无法加载npm.ps1,禁止运行脚本
前端·windows·npm·openclaw
昨日余光1 小时前
建议收藏!我开发了一个免费无限制的AI绘画公益站!
开发语言·前端·javascript·ai作画·typescript
意疏1 小时前
openJiuwen实战:用AsyncCallbackFramework为Agent增强器添加可观测性
java·服务器·前端