<!DOCTYPE html>
<html>
<head>
	<title>旋转文字</title>
	<style>
		#bike-wheel {
			width: 200px;
			height: 200px;
			border-radius: 50%;
			border: 10px solid black;
			position: relative;
			animation: rotate 2s linear infinite;
		}
		@keyframes rotate {
			from {
				transform: rotate(0deg);
			}
			to {
				transform: rotate(360deg);
			}
		}
		#text {
			position: absolute;
			top: 85px;
			left: 85px;
			font-size: 20px;
			transform-origin: center;
			animation: orbit 2s linear infinite;
		}
		@keyframes orbit {
			from {
				transform: rotate(0deg) translateX(90px) rotate(0deg);
			}
			to {
				transform: rotate(360deg) translateX(90px) rotate(-360deg);
			}
		}
	</style>
</head>
<body>
	<div id='bike-wheel'></div>
	<input type='text' id='input-text'>
	<button onclick='rotateText()'>旋转文字</button>
	<script>
		function rotateText() {
			var text = document.getElementById('input-text').value;
			document.getElementById('text').innerHTML = text;
		}
	</script>
	<div id='text'></div>
</body>
</html>
HTML 代码实现文字绕自行车轮旋转动画

原文地址: https://www.cveoy.top/t/topic/nWf0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录