程序员可能要失业了,有感于deepseek用单个html文件完成动画

news/2025/3/28 9:15:28/文章来源:https://www.cnblogs.com/cblx/p/18791176

在知乎看到说deepseek有更新,然后里面有个测试内容,照搬过来试了试,关键词如下:

创建一个包含 CSS 和 JavaScript 的单个 HTML 文件,以生成一个动画天气卡片。卡片应通过不同的动画直观地表示以下天气条件:风:(例如,移动的云朵、摇曳的树木或风线)雨:(例如,落下的雨滴、形成的水坑)晴:(例如,闪耀的光线、明亮的背景)雪:(例如,落下的雪花、积雪)并排显示所有天气卡片。卡片应具有深色背景。在此单个文件中提供所有 HTML、CSS 和 JavaScript 代码。JavaScript 应包含一种在不同天气条件之间切换的方法(例如,一个函数或一组按钮),以演示每种天气的动画。

 

然后就真的生成了一个单html文件,然后我点击下面的运行按钮,运行了起来,效果惊艳。

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>动画天气卡片</title><style>body {font-family: 'Arial', sans-serif;background-color: #121212;color: #fff;margin: 0;padding: 20px;display: flex;flex-direction: column;align-items: center;}h1 {margin-bottom: 30px;text-align: center;}.weather-container {display: flex;flex-wrap: wrap;justify-content: center;gap: 20px;margin-bottom: 30px;width: 100%;max-width: 1200px;}.weather-card {width: 250px;height: 350px;background-color: #1e1e1e;border-radius: 15px;padding: 20px;box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);position: relative;overflow: hidden;}.weather-title {font-size: 24px;margin-bottom: 15px;text-align: center;z-index: 2;position: relative;}.controls {margin-bottom: 30px;display: flex;gap: 10px;flex-wrap: wrap;justify-content: center;}button {padding: 10px 20px;background-color: #333;color: white;border: none;border-radius: 5px;cursor: pointer;font-size: 16px;transition: background-color 0.3s;}button:hover {background-color: #555;}button.active {background-color: #0078d7;}/* 风动画 */.wind .cloud {position: absolute;background-color: #555;border-radius: 50%;opacity: 0.8;}.wind .cloud1 {width: 60px;height: 30px;top: 80px;left: -70px;animation: cloudMove 8s linear infinite;}.wind .cloud2 {width: 80px;height: 40px;top: 120px;left: -90px;animation: cloudMove 10s linear infinite 2s;}.wind .tree {position: absolute;bottom: 50px;left: 50%;transform: translateX(-50%);}.wind .trunk {width: 15px;height: 80px;background-color: #5e2c04;margin: 0 auto;}.wind .leaves {width: 80px;height: 80px;background-color: #2a5c03;border-radius: 50%;position: relative;bottom: 20px;transform-origin: bottom center;animation: sway 3s ease-in-out infinite alternate;}.wind .wind-line {position: absolute;height: 2px;background-color: rgba(255, 255, 255, 0.5);transform-origin: left center;animation: windFlow 4s linear infinite;}/* 雨动画 */.rain .raindrop {position: absolute;width: 2px;background-color: rgba(174, 194, 224, 0.8);animation: rainFall linear infinite;}.rain .puddle {position: absolute;bottom: 30px;border-radius: 50%;background-color: rgba(100, 149, 237, 0.4);opacity: 0;animation: puddleForm 1s ease-out infinite;}/* 晴动画 */.sunny {background: linear-gradient(to bottom, #1e3c72, #2a5298);}.sunny .sun {position: absolute;width: 80px;height: 80px;background-color: #ffdb58;border-radius: 50%;top: 70px;left: 50%;transform: translateX(-50%);box-shadow: 0 0 40px 15px #ffdb58;}.sunny .sun-ray {position: absolute;background-color: rgba(255, 219, 88, 0.6);animation: sunShine 4s ease-in-out infinite;}/* 雪动画 */.snow .snowflake {position: absolute;color: white;font-size: 14px;animation: snowFall linear infinite;opacity: 0.8;}.snow .snow-accumulation {position: absolute;bottom: 0;left: 0;right: 0;height: 0;background-color: white;opacity: 0.8;animation: snowAccumulate 10s linear infinite;}/* 动画定义 */@keyframes cloudMove {0% { transform: translateX(-100px); }100% { transform: translateX(350px); }}@keyframes sway {0% { transform: rotate(-15deg); }100% { transform: rotate(15deg); }}@keyframes windFlow {0% { transform: translateX(0) scaleX(0);opacity: 0;}10% { opacity: 0.5; }70% { opacity: 0.5; }100% { transform: translateX(200px) scaleX(2);opacity: 0;}}@keyframes rainFall {0% { transform: translateY(-10px); height: 10px;}70% { height: 15px; }100% { transform: translateY(250px); height: 5px;}}@keyframes puddleForm {0% { transform: scale(0); opacity: 0.5;}100% { transform: scale(2); opacity: 0;}}@keyframes sunShine {0%, 100% { opacity: 0.3; }50% { opacity: 0.8; }}@keyframes snowFall {0% { transform: translateY(-10px) rotate(0deg); opacity: 0;}10% { opacity: 0.8; }90% { opacity: 0.8; }100% { transform: translateY(250px) rotate(360deg); opacity: 0;}}@keyframes snowAccumulate {0% { height: 0; }100% { height: 30px; }}</style>
</head>
<body><h1>动画天气卡片</h1><div class="controls"><button onclick="showAllWeather()" class="active">显示全部</button><button onclick="showWeather('wind')"></button><button onclick="showWeather('rain')"></button><button onclick="showWeather('sunny')"></button><button onclick="showWeather('snow')"></button></div><div class="weather-container"><div class="weather-card wind" id="wind-card"><h2 class="weather-title"></h2><div class="cloud cloud1"></div><div class="cloud cloud2"></div><div class="tree"><div class="trunk"></div><div class="leaves"></div></div></div><div class="weather-card rain" id="rain-card"><h2 class="weather-title"></h2></div><div class="weather-card sunny" id="sunny-card"><h2 class="weather-title"></h2><div class="sun"></div></div><div class="weather-card snow" id="snow-card"><h2 class="weather-title"></h2><div class="snow-accumulation"></div></div></div><script>// 初始化天气元素function initWeatherElements() {// 创建风的线条
            const windCard = document.getElementById('wind-card');for (let i = 0; i < 8; i++) {const windLine = document.createElement('div');windLine.className = 'wind-line';windLine.style.top = `${50 + Math.random() * 150}px`;windLine.style.left = `${Math.random() * 200}px`;windLine.style.width = `${30 + Math.random() * 50}px`;windLine.style.animationDelay = `${Math.random() * 4}s`;windCard.appendChild(windLine);}// 创建雨滴和水坑
            const rainCard = document.getElementById('rain-card');for (let i = 0; i < 30; i++) {const raindrop = document.createElement('div');raindrop.className = 'raindrop';raindrop.style.left = `${Math.random() * 230}px`;raindrop.style.animationDuration = `${0.5 + Math.random() * 1.5}s`;raindrop.style.animationDelay = `${Math.random() * 2}s`;rainCard.appendChild(raindrop);if (i % 5 === 0) {const puddle = document.createElement('div');puddle.className = 'puddle';puddle.style.left = `${20 + Math.random() * 190}px`;puddle.style.width = `${20 + Math.random() * 30}px`;puddle.style.height = `${10 + Math.random() * 10}px`;puddle.style.animationDelay = `${Math.random() * 5}s`;rainCard.appendChild(puddle);}}// 创建阳光射线
            const sunnyCard = document.getElementById('sunny-card');for (let i = 0; i < 12; i++) {const ray = document.createElement('div');ray.className = 'sun-ray';ray.style.width = '80px';ray.style.height = '10px';ray.style.top = '110px';ray.style.left = '125px';ray.style.transformOrigin = 'left center';ray.style.transform = `rotate(${i * 30}deg)`;ray.style.animationDelay = `${i * 0.2}s`;sunnyCard.appendChild(ray);}// 创建雪花
            const snowCard = document.getElementById('snow-card');for (let i = 0; i < 50; i++) {const snowflake = document.createElement('div');snowflake.className = 'snowflake';snowflake.innerHTML = '';snowflake.style.left = `${Math.random() * 230}px`;snowflake.style.animationDuration = `${3 + Math.random() * 7}s`;snowflake.style.animationDelay = `${Math.random() * 5}s`;snowCard.appendChild(snowflake);}}// 显示特定天气function showWeather(weatherType) {const cards = document.querySelectorAll('.weather-card');cards.forEach(card => {card.style.display = 'none';});document.getElementById(`${weatherType}-card`).style.display = 'block';// 更新按钮状态
            const buttons = document.querySelectorAll('.controls button');buttons.forEach(button => {button.classList.remove('active');});event.target.classList.add('active');}// 显示所有天气卡片function showAllWeather() {const cards = document.querySelectorAll('.weather-card');cards.forEach(card => {card.style.display = 'block';});// 更新按钮状态
            const buttons = document.querySelectorAll('.controls button');buttons.forEach(button => {button.classList.remove('active');});buttons[0].classList.add('active');}// 页面加载时初始化
        window.onload = function() {initWeatherElements();};</script>
</body>
</html>

 

结论是:太惊讶太可怕了,程序员都要失业了

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/905419.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

律所管理太费劲?用对系统,让你的律所越做越大!

做律所管理,光会打官司不够,你得是个“ 全能型选手 ”。 不仅要懂法律,还得会 经营、管理、营销、服务 。否则,客户难找、团队不好带、案子越来越乱,日子也越来越难过。 那具体需要哪些能力呢?这 六大能力 ,每一项都很重要,但要靠人工管理,效率太低,容易出错。这时候…

20244221李留斌《python程序设计》实验一报高

20244104 2024-2025-2 《Python程序设计》实验x报告 课程:《Python程序设计》 班级:2442 姓名:李留斌 学号:20244221 实验教师:王志强 实验日期:2025年3月23日 必修/选修: 公选课 一、实验内容 1.熟悉Python开发环境; 2.练习Python运行、调试技能; 3.编写程序,练习…

Pydantic异步校验器深:构建高并发验证系统

title: Pydantic异步校验器深:构建高并发验证系统 date: 2025/3/25 updated: 2025/3/25 author: cmdragon excerpt: Pydantic异步校验器基于async/await实现非阻塞验证,支持DNS查询等网络操作。高并发场景下运用批量API验证与异步数据库查询,通过asyncio.gather提升吞吐效…

《电子营业执照》的下载及使用

【电子营业执照的下载及使用】可以直接点此进行学习,也可以看下面我自己写的 一、电子营业执照的下载 (1)打开法人的手机微信,在微信中搜索“电子营业执照小程序”(2)点击“下载执照”(3)输入身份信息(4)人脸识别(5)选择登记地“甘肃”(6)下载执照二、电子营业执…

3月24日练习

第五题:最优配餐 考点:多源bfs 当权重(每条边开销为1)的最短路问题可以用bfs 做法:将每个分店先入队,然后依次对每个分店向前后左右走,只要能到达客户那里那么当前饭店就是距离客户最近的饭店,满足了这个客户以后要对这个用户标注不重复遍历。 算法思想:#include<b…

lc 315. 计算右侧小于当前元素的个数

```C typedef struct Node {int num; // 值int index; // 原数组索引int size; // 逆序对数量 } Node;class Solution { public:void mergeSort(vector<Node> &arr, int left, int right) {if (left >= right) return;int mid = (left + right) >> 1;…

windows 修改chrome默认安装目录

现在最新版的 Chrom 在安装时仍然不允许用户选择安装路径, 32 位版本会安装到 C:\Program Files (x86)\Google\Chrome 目录,64 位版本会安装到 C:\Program Files\Google\Chrome 目录,而其用户数据目录仍然被设置在当前用户目录下 C:\Users\%USERPROFILE%\AppData\Local\Goog…

Android 8.0系统的通知栏适配

为什么要进行通知栏适配? 现在经常是早上一觉醒来拿起手机一看,通知栏上全是各种APP的推送,烦。随着智能手机发展的成熟,通知栏搞得越来越不讨人喜欢了。各个App都希望抢占通知栏的空间,来尽可能地销售自己的产品。 通知栏是Android系统原创的,虽说乔布斯一直认为Android…

日事清25年战略目标如何高效执行?企业组织架构优化与项目管理全流程解析

如何使用日事清搭建一份可实现的25年战略目标-执行体系?在这个快节奏的商业世界里,每个企业都需要弄清楚几个超重要的问题: 首先,你的企业使命和抱负够不够清晰 ——能不能让每一个员工充满归属感和使命感? 然后,你们团队有没有一个明确的目标体系?还是只是在“摸着石头…

Obsidian 笔记一键转换发布为 Jekyll 博客

Obsidian 是一款功能强大且灵活的知识管理和笔记软件,与 Jekyll 这一轻量级静态博客框架的结合,既能保留 Obsidian 的网状知识关联优势,又能借助 Jekyll 的高效编译能力快速生成标准化博文。 Obsidian 笔记自动转换为 Jekyll 博客一文介绍了如何把挑选出的 Obsidian 笔记转换…

变更《营业执照》操作流程

第一步:打开甘肃政务服务网 https://zwfw.gansu.gov.cn/ 第二步:登录 (1)右上角(2)点“法人登录”(3)点“电子营业执照登录”第三步:使用【电子营业执照】的【扫一扫】进行登录 (1)打开法人的手机微信,在微信中搜索“电子营业执照小程序”(2)点击“扫一扫”(3)…

DVWA靶场安装教程

1 靶场下载github 下载 https://github.com/digininja/DVWAgithub网站在国外,有时不能访问,可以下载我分享的这个:百度网盘分享 https://pan.baidu.com/s/1vIsf_VFiY9Ah3DG3Ichsyg?pwd=zyvf 2 靶场部署 2.1 解压缩靶场 解压缩后,只保留DVWA-master文件夹,里面是靶场代码…