网站首页 > 知识剖析 正文
用 Claude Sonnet 3.7 的天气测试编码,让谷歌VS Code AI 编程插件 Gemini Code Assist 自动编程。
生成的文件在浏览器中的效果如下:(附源代码)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated Weather Cards</title>
<style>
body {
background-color: #2c3e50; /* Dark background */
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
}
.weather-container {
display: flex;
gap: 20px;
margin-bottom: 20px;
flex-wrap: wrap;
justify-content: center;
}
.weather-card {
width: 150px;
height: 200px;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
overflow: hidden;
color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
margin: 10px;
}
.weather-card.sun {
background: radial-gradient(circle, rgba(255,223,0,1) 0%, rgba(255,153,0,1) 100%);
}
.weather-card.rain {
background: linear-gradient(to bottom, #00c6ff, #0072ff);
}
.weather-card.snow {
background: linear-gradient(to bottom, #e0eafc, #cfdef3);
}
.weather-card.wind {
background: linear-gradient(to bottom, #bdc3c7, #2c3e50);
}
/* Sun Animation */
.sun-rays {
width: 100px;
height: 100px;
background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 70%);
position: absolute;
animation: rotate 5s linear infinite;
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Rain Animation */
.raindrop {
width: 5px;
height: 15px;
background: #fff;
position: absolute;
bottom: 100%;
animation: fall 1s linear infinite;
}
@keyframes fall {
0% { bottom: 100%; }
100% { bottom: 0; }
}
/* Snow Animation */
.snowflake {
width: 10px;
height: 10px;
background: #fff;
border-radius: 50%;
position: absolute;
top: -10px;
animation: snow 3s linear infinite;
}
@keyframes snow {
0% { top: -10px; }
100% { top: 100%; }
}
/* Wind Animation */
.wind-line {
width: 100px;
height: 2px;
background: #fff;
position: absolute;
left: -100px;
animation: blow 2s linear infinite;
}
@keyframes blow {
0% { left: -100px; }
100% { left: 100%; }
}
.button-container {
display: flex;
justify-content: center;
gap: 10px;
margin-bottom: 20px;
}
.button-container button {
padding: 10px 20px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
.button-container button:hover {
background-color: #2980b9;
}
.label {
position: absolute;
bottom: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="button-container">
<button onclick="switchWeather('sun')">Sun</button>
<button onclick="switchWeather('rain')">Rain</button>
<button onclick="switchWeather('snow')">Snow</button>
<button onclick="switchWeather('wind')">Wind</button>
<button onclick="showAll()">Show All</button>
</div>
<div class="weather-container">
<div class="weather-card sun">
<div class="sun-rays"></div>
<div class="label">Sun</div>
</div>
<div class="weather-card rain">
<div class="raindrop" style="left: 20%; animation-delay: 0s;"></div>
<div class="raindrop" style="left: 50%; animation-delay: 0.2s;"></div>
<div class="raindrop" style="left: 80%; animation-delay: 0.4s;"></div>
<div class="label">Rain</div>
</div>
<div class="weather-card snow">
<div class="snowflake" style="left: 20%; animation-delay: 0s;"></div>
<div class="snowflake" style="left: 50%; animation-delay: 1s;"></div>
<div class="snowflake" style="left: 80%; animation-delay: 2s;"></div>
<div class="label">Snow</div>
</div>
<div class="weather-card wind">
<div class="wind-line" style="top: 30%; animation-delay: 0s;"></div>
<div class="wind-line" style="top: 50%; animation-delay: 1s;"></div>
<div class="wind-line" style="top: 70%; animation-delay: 2s;"></div>
<div class="label">Wind</div>
</div>
</div>
<script>
function switchWeather(condition) {
const cards = document.querySelectorAll('.weather-card');
cards.forEach(card => {
if(card.classList.contains(condition)) {
card.style.display = 'flex';
}else{
card.style.display = 'none';
}
});
}
function showAll(){
const cards = document.querySelectorAll('.weather-card');
cards.forEach(card => {
card.style.display = 'flex';
});
}
showAll();
</script>
</body>
</html>
猜你喜欢
- 2025-09-18 50 道高频 JavaScript 面试题,从基础到进阶 (附答案)
- 2025-09-18 Origami动效制作-入门必看(附3个练习案例)
- 2025-09-18 Android 流畅度检测原理简析_手机流畅度检测
- 2025-09-18 SwiftUI入门五:让视图和过渡动起来
- 2025-09-18 抖音品质建设 - iOS启动优化《原理篇》
- 2025-09-18 手机性能好不好 GPU玄学曲线告诉你
- 2025-09-18 使用ImageMagick自动化图片处理_image图像处理软件
- 2025-09-18 CollectionView 添加/删除动画_recyclerview添加动画
- 2025-09-18 CSS 中实现动画效果的方法_css实现动画有哪些方式
- 2025-09-18 如何让element ui table 用上ant的loading图标
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)