我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞

马肤

温馨提示:这篇文章已超过462天没有更新,请注意相关的内容是否还可用!

摘要:用户请求ChatGPT使用CSS3绘制一个皮卡丘,然而用户更倾向于自己手绘的可爱风格。虽然CSS3是一种强大的网页设计工具,可以用于创建各种图形和动画,但用户可能更喜欢传统的手绘方式来表达皮卡丘的可爱形象。无论是通过CSS3还是手绘,皮卡丘的魅力都能得到展现。

突然想到了小时候看过的动画片《皮卡丘》,于是突然就想,ChatGPT肯定也看过,他哪有不知道的东西啊,于是就想着让他帮我画一个,他画出来之后,我笑了,这啥玩意儿啊。

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第1张

 

目录

一、第一次尝试让ChatGPT用CSS3画皮卡丘

1. 绘制皮卡丘的耳朵:

2. 绘制皮卡丘的眼睛:

3. 绘制皮卡丘的嘴巴:

4. 绘制皮卡丘的尾巴:

二、第二次尝试ChatGPT完整版皮卡丘 

CSS3代码如下

三、自己动手用CSS3画皮卡丘吧

1. 实现思路

2. HTML部分源代码

3. CSS3部分源代码


一、第一次尝试让ChatGPT用CSS3画皮卡丘

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第2张

 

很抱歉,作为一名语言模型,我无法直接向您呈现一个用CSS3画皮卡丘的过程。不过,我可以提供一些指导和思路,帮助您开始这个项目。

首先,您需要了解如何使用CSS3来绘制基本的形状和动画。以下是一些您可能需要用到的基本属性:

  1. border-radius:用于创建圆角矩形。
  2. transform:用于旋转、缩放和平移元素。
  3. animation:用于创建动画效果。
  4. box-shadow:用于添加阴影效果。

绘制皮卡丘的关键在于绘制它的耳朵、眼睛、嘴巴和尾巴等特征。以下是一些可能有用的CSS3代码片段:

1. 绘制皮卡丘的耳朵:

 

.ear {
  width: 50px;
  height: 80px;
  background-color: #FEE440;
  border-radius: 50% 50% 0 0;
  transform: rotate(-45deg);
}

2. 绘制皮卡丘的眼睛:

.eye {
  width: 30px;
  height: 30px;
  background-color: #000000;
  border-radius: 50%;
  position: relative;
  animation: blink 5s infinite;
}
.eye::before {
  content: "";
  width: 12px;
  height: 12px;
  background-color: #FFFFFF;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 5px;
}

3. 绘制皮卡丘的嘴巴:

.mouth {
  width: 60px;
  height: 30px;
  border: 2px solid #000000;
  border-top: none;
  border-radius: 0 0 50px 50px;
  position: relative;
  top: 20px;
}
.tongue {
  width: 30px;
  height: 30px;
  background-color: #FF4F6F;
  border-radius: 50%;
  position: absolute;
  bottom: -15px;
  left: 15px;
}

4. 绘制皮卡丘的尾巴:

.tail {
  width: 120px;
  height: 30px;
  background-color: #FEE440;
  border-radius: 15px;
  transform: rotate(-30deg);
  position: relative;
  top: -40px;
  left: 50px;
}
.tail::before {
  content: "";
  width: 20px;
  height: 20px;
  background-color: #000000;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 90px;
}

以上代码片段只是皮卡丘的一部分,您需要自己根据需要进行修改和调整。希望这些代码片段能够帮助您开始这个有趣的项目!

刚开始他并没有给出我HTML代码,我就自己试着写了几个DIV,于是效果是这样子的,请看

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第3张

二、第二次尝试ChatGPT完整版皮卡丘 

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第4张

我想着肯定是我HTML元素弄得不对,处于开发人员自己不动手,靠工具去创造的精神,我跟ChatGPT说,你把这些代码片段组合起来,给我形成一个完整的皮卡丘。于是, 

 

将这些代码片段组合在一起,形成一个完整的皮卡丘需要以下步骤:

  1. 在 HTML 文件中创建一个  元素,作为皮卡丘的容器,设置它的样式,例如 position: relative;。
  2. 在容器中创建一个  元素,作为皮卡丘的身体,设置它的样式,例如 width: 200px; height: 200px; background-color: #FEE440; border-radius: 50%;。
  3. 在身体中创建两个  元素,作为皮卡丘的耳朵,设置它们的样式,例如根据上面的代码片段设置。
  4. 在身体中创建两个  元素,作为皮卡丘的眼睛,设置它们的样式,例如根据上面的代码片段设置。
  5. 在身体中创建一个  元素,作为皮卡丘的鼻子,设置它的样式,例如 width: 30px; height: 30px; background-color: #FFA200; border-radius: 50%; position: absolute; top: 70px; left: 85px;。
  6. 在身体中创建一个  元素,作为皮卡丘的嘴巴,设置它的样式,例如根据上面的代码片段设置。
  7. 在嘴巴中创建一个  元素,作为皮卡丘的舌头,设置它的样式,例如根据上面的代码片段设置。
  8. 在身体中创建一个  元素,作为皮卡丘的尾巴,设置它的样式,例如根据上面的代码片段设置。
  9. 根据需要调整各元素的位置和大小,以形成一个完整的皮卡丘。

以下是一个简单的示例代码,可以帮助您更好地理解:

HTML代码如下

  
  
  
  
  
  
  
    
  
  

CSS3代码如下

.pikachu {
  position: relative;
  width: 200px;
  height: 200px;
}
.body {
  width: 200px;
  height: 200px;
  background-color: #FEE440;
  border-radius: 50%;
}
.ear {
  width: 50px;
  height: 80px;
  background-color: #FEE440;
  border-radius: 50% 50% 0 0;
  transform: rotate(-45deg);
  position: absolute;
  top: -30px;
}
.left {
  left: 40px;
}
.right {
  right: 40px;
}
.eye {
  width: 30px;
  height: 30px;
  background-color: #000000;
  border-radius: 50%;
  position: absolute;
  top: 40px;
  animation: blink 5s infinite;
}
.nose {
  width: 30px;
  height: 30px;
  background-color: #FFA200;
  border-radius: 50%;
  position: absolute;
  top: 70px;
  left: 85px;
}
.mouth {
  width: 60px;
  height: 30px;
  border: 2px solid #000000;
  border-top: none;
  border-radius: 0 0 50px 50px;
  position: absolute;
  top: 90px;
  left: 70px;
}
.tongue {
  width: 30px;
  height: 30px;
  background-color: #FF4F6F;
  border-radius: 50%;
  position: absolute;
  bottom: -15px;
  left: 15px;
}
.tail {
  width: 120px;
  height: 30px;
  background-color: #FEE440;
  border-radius: 15px;
  transform: rotate(-30deg);
  position: absolute;
  top: 130px;
  left: -10px;
}
.tail::before {
  content: "";
  width: 20px;
  height: 20px;
  background-color: #000000;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 90px;
}

 请看结果:这是皮卡丘?莫非他进化了?

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第5张

 

三、自己动手用CSS3画皮卡丘吧

我让ChatGPT用CSS3画一个皮卡丘,还是自己画的可爱,我用CSS3绘制皮卡丘,自创与AI的可爱碰撞 第6张

1. 实现思路

耳朵,耳朵尖,头部,脸夹,眼睛,眼珠子,鼻子,可爱的小嘴,舌头

涉及到的CSS3属性,radial-gradient 的背景填充,animation 的耳朵尖动画,头部border-radius的圆角边框,右下角box-shadow的阴影显示,眼睛和眼珠子的定位,这里采用了::before,鼻子类似于用css实现一个三角形的写法,15px solid transparent ,脸夹是背景颜色的设置,圆角边框的实现,以及定位,小嘴巴涉及到了 box-shadow : inset 0px -4px 0 #1b1919 的阴影,或者做一个圆角也可以实现

2. HTML部分源代码

  
  
  
    
    
    
    
    
    
    
  

3. CSS3部分源代码

body {
  display: flex;
  height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
  background: linear-gradient(#f2fcff, #b9e4f7);
  overflow:hidden;
}
.pikachu {
  position: relative;
}
@media (max-width: 600px) {
  .pikachu {
    transform: scale(0.5);
  }
}
.head {
  position: relative;
  margin-top: 200px;
  width: 370px;
  height: 330px;
  background: #ffd01c;
  border: 4px solid #1b1919;
  border-radius: 45%;
  overflow: hidden;
  box-shadow: inset -10px -8px 0 #d8851c;
}
.left-eye,
.right-eye {
  position: absolute;
  width: 70px;
  height: 70px;
  background-color: #1b1919;
  border-radius: 50%;
  top: 40%;
}
.left-eye::before,
.right-eye::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  background-color: white;
  border-radius: 50%;
  top: 10%;
  animation: 0.2s infinite shaking;
}
.left-eye {
  left: 20%;
}
.left-eye::before {
  left: 40%;
}
.right-eye {
  right: 20%;
}
.right-eye::before {
  right: 40%;
}
.nose {
  position: relative;
  width: 0;
  height: 0;
  border-top: 10px solid #1b1919;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 10px solid transparent;
  border-radius: 8px;
  margin: auto;
  top: 60%;
}
.left-cheek,
.right-cheek {
  position: absolute;
  width: 80px;
  height: 80px;
  background-color: #fb1412;
  border: 4px solid #1b1919;
  border-radius: 50%;
  top: 60%;
}
.left-cheek {
  left: -5%;
}
.right-cheek {
  right: -5%;
}
.lips {
  display: block;
  position: relative;
  margin: auto;
  width: 1px;
  height: 1px;
  top: 60%;
  z-index: 2;
}
.lips::after, .lips::before {
  position: absolute;
  content: "";
  top: -20px;
  width: 50px;
  height: 40px;
  border-radius: 50%;
  box-shadow: inset 0px -4px 0 #1b1919;
  background-color: #ffd01c;
}
.lips::before {
  right: 0px;
}
.lips::after {
  left: 0px;
}
.mouth {
  position: relative;
  height: 60px;
  width: 60px;
  margin: auto;
  top: 60%;
  border: 4px solid #1b1919;
  border-radius: 0 0 50% 50%;
  z-index: 1;
  background-image: radial-gradient(circle at center 80%, #e93c4e 0%, #e93c4e 50%, #9e2d38 50%, #9e2d38 60%, #1b1919 60%, #1b1919 65%, #5c0009 65%);
  background-position: 80% center;
}
.left-ear,
.right-ear {
  position: absolute;
  height: 450px;
  width: 70px;
  background: #ffd01c;
  border-radius: 50%;
  border: 4px solid #1b1919;
  box-shadow: inset -4px -120px 0 #d8851c;
}
.right-ear {
  right: 10px;
  transform: rotate(12deg);
  background-image: radial-gradient(circle at -100% 45%, #ffd01c 0%, #ffd01c 60%, black 60%);
}
.left-ear {
  left: 10px;
  transform: rotate(-50deg);
  background-image: radial-gradient(circle at 200% 45%, #ffd01c 0%, #ffd01c 60%, black 60%);
  animation: 5s 5s infinite wiggle;
  animation-fill-mode: forwards;
  animation-direction: alternate;
}
@keyframes shaking {
  from {
    transform: translateX(0%);
  }
  to {
    transform: translateX(2%);
  }
}
@keyframes wiggle {
  0% {
    transform: rotate(-50deg);
  }
  5% {
    transform: rotate(-60deg);
  }
  10% {
    transform: rotate(-50deg);
  }
  12% {
    transform: rotate(-55deg);
  }
  15% {
    transform: rotate(-50deg);
  }
  100% {
    transform: rotate(-50deg);
  }
}

最终画出了可爱的皮卡丘,快拿到代码去感受一下吧。


0
收藏0
文章版权声明:除非注明,否则均为VPS857原创文章,转载或复制请以超链接形式并注明出处。

相关阅读

  • 【研发日记】Matlab/Simulink自动生成代码(二)——五种选择结构实现方法,Matlab/Simulink自动生成代码的五种选择结构实现方法(二),Matlab/Simulink自动生成代码的五种选择结构实现方法详解(二)
  • 超级好用的C++实用库之跨平台实用方法,跨平台实用方法的C++实用库超好用指南,C++跨平台实用库使用指南,超好用实用方法集合,C++跨平台实用库超好用指南,方法与技巧集合
  • 【动态规划】斐波那契数列模型(C++),斐波那契数列模型(C++实现与动态规划解析),斐波那契数列模型解析与C++实现(动态规划)
  • 【C++】,string类底层的模拟实现,C++中string类的模拟底层实现探究
  • uniapp 小程序实现微信授权登录(前端和后端),Uniapp小程序实现微信授权登录全流程(前端后端全攻略),Uniapp小程序微信授权登录全流程攻略,前端后端全指南
  • Vue脚手架的安装(保姆级教程),Vue脚手架保姆级安装教程,Vue脚手架保姆级安装指南,Vue脚手架保姆级安装指南,从零开始教你如何安装Vue脚手架
  • 如何在树莓派 Raspberry Pi中本地部署一个web站点并实现无公网IP远程访问,树莓派上本地部署Web站点及无公网IP远程访问指南,树莓派部署Web站点及无公网IP远程访问指南,本地部署与远程访问实践,树莓派部署Web站点及无公网IP远程访问实践指南,树莓派部署Web站点及无公网IP远程访问实践指南,本地部署与远程访问详解,树莓派部署Web站点及无公网IP远程访问实践详解,本地部署与远程访问指南,树莓派部署Web站点及无公网IP远程访问实践详解,本地部署与远程访问指南。
  • vue2技术栈实现AI问答机器人功能(流式与非流式两种接口方法),Vue2技术栈实现AI问答机器人功能,流式与非流式接口方法探究,Vue2技术栈实现AI问答机器人功能,流式与非流式接口方法详解
  • 发表评论

    快捷回复:表情:
    评论列表 (暂无评论,0人围观)

    还没有评论,来说两句吧...

    目录[+]

    取消
    微信二维码
    微信二维码
    支付宝二维码