CSS常用示例100+专栏目录

css实战中,怎么绘制图标图片悬浮旋转一周效果呢?主要利用了transform: rotateY(1turn);的神奇功能,hover时候,图片旋转一周,背景色也跟着变一下。

效果图

CSS特效019:图标图片悬浮旋转一周-LMLPHP

源代码

/*
* @Author: 大剑师兰特(xiaozhuanlan),还是大剑师兰特(CSDN)
* @此源代码版权归大剑师兰特所有,可供学习或商业项目中借鉴,未经授权,不得重复地发表到博客、论坛,问答,git等公共空间或网站中。
* @Email: 2909222303@qq.com
* @weixin: gis-dajianshi
* @First published in CSDN
* @First published time: 2023-11-26
*/
<template>
	<div class="container">
		<div class="top">
			<h3>图标图片悬浮旋转一周</h3>
			<div class="author">大剑师兰特, 还是大剑师兰特,gis-dajianshi</div>
		</div>
		<div class="dajianshi">
			<svg viewBox="0 0 1024 1024" p-id="2419" width="80" height="80">
				<path
					d="M512 42.666667A464.64 464.64 0 0 0 42.666667 502.186667 460.373333 460.373333 0 0 0 363.52 938.666667c23.466667 4.266667 32-9.813333 32-22.186667v-78.08c-130.56 27.733333-158.293333-61.44-158.293333-61.44a122.026667 122.026667 0 0 0-52.053334-67.413333c-42.666667-28.16 3.413333-27.733333 3.413334-27.733334a98.56 98.56 0 0 1 71.68 47.36 101.12 101.12 0 0 0 136.533333 37.973334 99.413333 99.413333 0 0 1 29.866667-61.44c-104.106667-11.52-213.333333-50.773333-213.333334-226.986667a177.066667 177.066667 0 0 1 47.36-124.16 161.28 161.28 0 0 1 4.693334-121.173333s39.68-12.373333 128 46.933333a455.68 455.68 0 0 1 234.666666 0c89.6-59.306667 128-46.933333 128-46.933333a161.28 161.28 0 0 1 4.693334 121.173333A177.066667 177.066667 0 0 1 810.666667 477.866667c0 176.64-110.08 215.466667-213.333334 226.986666a106.666667 106.666667 0 0 1 32 85.333334v125.866666c0 14.933333 8.533333 26.88 32 22.186667A460.8 460.8 0 0 0 981.333333 502.186667 464.64 464.64 0 0 0 512 42.666667"
					p-id="2420">
				</path>
			</svg>
		</div>
	</div>
</template>

<style scoped>
	.container {
		width: 1000px;
		height: 580px;
		margin: 50px auto;
		border: 1px solid green;
		position: relative;
	}

	.top {
		margin: 0 auto 0px;
		padding: 10px 0;
		background: darkcyan;
		color: #fff;
	}

	.dajianshi {
		width: 300px;
		height: 300px;
		margin: 50px auto;
		background: greenyellow;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	svg {
		transition: all 1s;
	}

	.dajianshi:hover {
		background: orange;
	}

	.dajianshi:hover svg {
		transform: rotateY(1turn);
	}
</style>


CSS基础知识点

结尾语

CSS的应用无处不在,希望某个片段就能帮助你,欢迎学习GIS的朋友一起交流。
《 Openlayers 综合示例200+ 》
《 leaflet示例教程100+ 》
《 Cesium示例教程100+》
《MapboxGL示例教程100+》

11-26 09:57