FreeCodeCamp-通过构建摩天轮学习 CSS 动画
1.FreeCodeCamp-通过构建一组彩色笔来学习 CSS 颜色2.FreeCodeCamp-通过编写咖啡店菜单学习CSS3.FreeCodeCamp-通过编写注册表单学习 HTML 表单4.FreeCodeCamp-通过创作罗斯科绘画学习 CSS 盒子模型5.FreeCodeCamp-通过创建照片集来学习 CSS 弹性盒子6.FreeCodeCamp-通过建立营养标签来学习排版7.FreeCodeCamp-通过编写小测验学习无障碍8.FreeCodeCamp-创建一副毕加索绘画来学习中级 CSS9.FreeCodeCamp-通过创建一架钢琴来学习响应式网页设计10.FreeCodeCamp-技术文档页11.FreeCodeCamp-通过建立城市轮廓学习 CSS 变量12.FreeCodeCamp-通过创建杂志学习 CSS 网格布局
13.FreeCodeCamp-通过构建摩天轮学习 CSS 动画
14.FreeCodeCamp-通过构建企鹅来学习 CSS 变换index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ferris Wheel</title>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<div class="wheel">
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
<div class="cabin"></div>
<div class="cabin"></div>
<div class="cabin"></div>
<div class="cabin"></div>
<div class="cabin"></div>
<div class="cabin"></div>
</div>
</body>
</html>
styles.css
.wheel {
border: 2px solid black;
border-radius: 50%;
margin-left: 50px;
position: absolute;
height: 55vw;
width: 55vw;
max-width: 500px;
max-height: 500px;
animation-name: wheel;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.line {
background-color: black;
width: 50%;
height: 2px;
position: absolute;
top: 50%;
left: 50%;
transform-origin: 0% 0%;
}
.line:nth-of-type(2) {
transform: rotate(60deg);
}
.line:nth-of-type(3) {
transform: rotate(120deg);
}
.line:nth-of-type(4) {
transform: rotate(180deg);
}
.line:nth-of-type(5) {
transform: rotate(240deg);
}
.line:nth-of-type(6) {
transform: rotate(300deg);
}
.cabin {
background-color: red;
width: 20%;
height: 20%;
position: absolute;
border: 2px solid;
transform-origin: 50% 0%;
animation: cabins 10s ease-in-out infinite;
}
.cabin:nth-of-type(1) {
right: -8.5%;
top: 50%;
}
.cabin:nth-of-type(2) {
right: 17%;
top: 93.5%;
}
.cabin:nth-of-type(3) {
right: 67%;
top: 93.5%;
}
.cabin:nth-of-type(4) {
left: -8.5%;
top: 50%;
}
.cabin:nth-of-type(5) {
left: 17%;
top: 7%;
}
.cabin:nth-of-type(6) {
right: 17%;
top: 7%;
}
@keyframes wheel {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes cabins {
0% {
transform: rotate(0deg);
}
25% {
background-color: yellow;
}
50% {
background-color: purple;
}
75%{
background-color: yellow;
}
100% {
transform: rotate(-360deg);
}
}
合集:
FreeCodeCamp
分类:
FreeCodeCamp
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?