Prompt让GPT画一朵会动的小花
作者:庄泽峰 / 2023-12-19 08:50
Prompt 1:Hello,GPT,请你用html5+CSS3来实现: 画一朵你认为好看的小花。
Prompt 2:哇,确实很好看,能让这朵小花动一动吗?
然后,GPT给出下面这朵会转动的小花:
<!DOCTYPE html>
<html>
<head>
<title>绘制小花</title>
<style>
.flower {
width: 200px;
height: 200px;
position: relative;
animation: rotate 5s infinite linear;
}
.petal {
position: absolute;
width: 80px;
height: 80px;
border-radius: 50%;
background-color: pink;
transform-origin: center center;
}
.petal:nth-child(1) {
top: 0;
left: 60px;
transform: rotate(45deg);
}
.petal:nth-child(2) {
top: 60px;
left: 0;
transform: rotate(45deg);
}
.petal:nth-child(3) {
top: 60px;
right: 0;
transform: rotate(-45deg);
}
.petal:nth-child(4) {
bottom: 0;
left: 60px;
transform: rotate(-45deg);
}
.petal:nth-child(5) {
bottom: 60px;
left: 0;
transform: rotate(-45deg);
}
.petal:nth-child(6) {
bottom: 60px;
right: 0;
transform: rotate(45deg);
}
.center {
position: absolute;
width: 40px;
height: 40px;
top: 80px;
left: 80px;
border-radius: 50%;
background-color: yellow;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="flower">
<div class="petal"></div>
<div class="petal"></div>
<div class="petal"></div>
<div class="petal"></div>
<div class="petal"></div>
<div class="petal"></div>
<div class="center"></div>
</div>
</body>
</html>