当前位置: 首页 > news >正文

纯CSS吃豆人(JS仅控制进度)

一、效果展示

请添加图片描述

二、源码

html

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Pac-Man SVG Demo</title>
</head>
<body><div class="controls"><label for="animation-slider">动画进度:</label><input type="number" id="slider-value" value="0" /><br /><input type="range" id="animation-slider" min="0" max="0.999" step="0.001" value="0"></div><div class="container"><svg viewBox="0 0 200 200" style="scale: 1"><circle class="body animation-control" r="50" cx="100" cy="100"></circle><circle class="eye animation-control" r="10" cx="150" cy="70"></circle><line class="upper-teeth animation-control" x1="100" y1="100" x2="200" y2="100"></line><path class="nose animation-control" d="M 199,100 A 99,99 0 1,0 198.9999999999985,100.0000172787596"></path></svg></div>
</body>
</html>

css

.container {display: flex;justify-content: center;align-items: center;height: 100vh;
}svg {--animation-delay: 0s;width: 200px;height: 200px;
}.body {fill: transparent;stroke: darkorange;stroke-width: 100;stroke-dasharray: 314.159; /* 2πr = 2 * π * 50 */stroke-dashoffset: 0;transform-origin: center;animation: pacman-mouth-open-close 1s infinite linear;
}
.upper-teeth {stroke: black;stroke-width: 2;transform-origin: center;animation: pacman-upper-body-rotation 1s infinite linear;
}
.eye {fill: white;transform-origin: center;animation: pacman-eye-close-polygon 1s infinite linear, pacman-upper-body-rotation 1s infinite linear;
}
.nose {fill: none;stroke: black;stroke-width: 2;transform-origin: center;animation: pacman-nose-adjust 1s infinite linear, pacman-upper-body-rotation 1s infinite linear;
}.animation-control {animation-delay: var(--animation-delay);animation-play-state: paused;
}/* 身体张合动画 */
@keyframes pacman-mouth-open-close {0% {stroke-dashoffset: 0;transform: rotate(0deg);}100% {stroke-dashoffset: 314.159;transform: rotate(180deg);}
}/* 上半身旋转跟随 */
@keyframes pacman-upper-body-rotation {0% {transform: rotate(0deg);}100% {transform: rotate(-180deg);}
}/* 眼睛缩小动画 */
@keyframes pacman-eye-shrink {0% {r: 10;}73% {r: 10;}83% {r: 0;}100% {r: 0;}
}/* 眼睛闭眼效果, 眼角方向平行于上牙膛(椭圆裁剪路径) */
@keyframes pacman-eye-close-ellipse {0% {clip-path: ellipse(50% 50% at 50% 50%);}73% {clip-path: ellipse(50% 50% at 50% 50%);}83% {clip-path: ellipse(50% 0% at 50% 50%);}100% {clip-path: ellipse(50% 0% at 50% 50%);}
}/* 眼睛闭眼效果, 眼角方向朝向身体圆心(多边形裁剪路径) */
@keyframes pacman-eye-close-polygon {/*正方形边框点*/0% {clip-path: polygon(0 80%, 0 100%, 20% 100%, 40% 100%, 60% 100%, 80% 100%, 100% 100%, 100% 80%, 100% 60%, 100% 40%, 100% 20%, 100% 0, 80% 0, 60% 0, 40% 0, 20% 0, 0 0, 0 20%, 0 40%, 0 60%);}/*正方形边框点*/73% {clip-path: polygon(0 80%, 0 100%, 20% 100%, 40% 100%, 60% 100%, 80% 100%, 100% 100%, 100% 80%, 100% 60%, 100% 40%, 100% 20%, 100% 0, 80% 0, 60% 0, 40% 0, 20% 0, 0 0, 0 20%, 0 40%, 0 60%);}/*贴圆边*/76% {clip-path: polygon(0 80%, 14% 86%, 23% 93%, 40% 100%, 60% 100%, 77% 94%, 86% 86%, 94% 77%, 100% 60%, 100% 40%, 100% 20%, 86% 14%, 77% 7%, 60% 0, 40% 0, 23% 7%, 14% 14%, 6% 23%, 0 40%, 0 60%);}/*两个扇形的弧线组合*/79% {clip-path: polygon(0 80%, 13% 82%, 26% 82%, 38% 80%, 51% 76%, 62% 71%, 73% 63%, 82% 54%, 90% 44%, 96% 32%, 100% 20%, 87% 18%, 74% 18%, 62% 20%, 49% 24%, 38% 29%, 27% 37%, 18% 46%, 10% 56%, 4% 68%);}/*闭眼*/83% {clip-path: polygon(0 80%, 10% 74%, 20% 68%, 30% 62%, 40% 56%, 50% 50%, 60% 44%, 70% 38%, 80% 32%, 90% 26%, 100% 20%, 90% 26%, 80% 32%, 70% 38%, 60% 44%, 50% 50%, 40% 56%, 30% 62%, 20% 68%, 10% 74%);}/*闭眼*/100% {clip-path: polygon(0 80%, 10% 74%, 20% 68%, 30% 62%, 40% 56%, 50% 50%, 60% 44%, 70% 38%, 80% 32%, 90% 26%, 100% 20%, 90% 26%, 80% 32%, 70% 38%, 60% 44%, 50% 50%, 40% 56%, 30% 62%, 20% 68%, 10% 74%);}
}/* 嘴越大, 身体越小, 添加动画防止鼻子超出身体 */
@keyframes pacman-nose-adjust {0% {clip-path: polygon(50% 50%, 100% 50%, 100% 0);}70% {clip-path: polygon(50% 50%, 100% 50%, 100% 0);}100% {clip-path: polygon(50% 50%, 100% 50%, 100% 50%);}
}
#animation-slider {width: 350px;position: absolute;z-index: 1;
}

js

// 防抖函数(默认延迟时间300毫秒)
function debounce(func, delay = 300) {let timer;return function() {const context = this;const args = arguments;clearTimeout(timer);timer = setTimeout(() => {func.apply(context, args);}, delay);};
}const slider = document.getElementById('animation-slider');
const sliderValue = document.getElementById('slider-value');
const svg = document.querySelector("svg");
// 滑块更新CSS变量
slider.addEventListener('input', function() {const newDelay = -this.value;svg.style.setProperty('--animation-delay', `${newDelay}s`);
});
// 滑块更新显示值输入框
slider.addEventListener('input', function() {sliderValue.value = this.value;
});
// 显示值输入框手动修改滑块值
sliderValue.addEventListener('input', debounce(function() {slider.value = this.value;slider.dispatchEvent(new Event('input', {'bubbles': true, 'cancelable': true}));
}));

三、源码(JS)

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Pac-Man SVG Demo</title><style>input[type="range"] {width: 100%;}.container {display: flex;flex-direction: column;align-items: center;}</style>
</head>
<body><div class="container" id="demo-container"></div><script>document.addEventListener('DOMContentLoaded', () => {const container = document.getElementById('demo-container');// 创建 SVGconst svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');svg.setAttribute('width', '200');svg.setAttribute('height', '200');svg.setAttribute('viewBox', '0 0 200 200');// 创建圆形(身体)const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');circle.setAttribute('r', '50');circle.setAttribute('cx', '100');circle.setAttribute('cy', '100');circle.setAttribute('fill', 'transparent');circle.setAttribute('stroke', 'darkorange');circle.setAttribute('stroke-width', '100');circle.style.transformOrigin = 'center';// 创建小圆点(眼睛)const dot = document.createElementNS('http://www.w3.org/2000/svg', 'circle');dot.setAttribute('r', '10');dot.setAttribute('cx', '150');dot.setAttribute('cy', '70');dot.setAttribute('fill', 'white');dot.style.transformOrigin = 'center';// 根据旋转值设置半径const dotObserver = new MutationObserver((mutations) => {// 获取元素的当前旋转值const currentRotate = parseFloat(getComputedStyle(dot).getPropertyValue('rotate')) || 0;// 根据旋转值设置半径(dot 的角度范围是 180 度到 360 度)let limitRotateA = 210;let limitRotateB = 240;if (currentRotate >= 180 && currentRotate < limitRotateA) {// 保持 0 不变dot.setAttribute('r', `0`);} else if (currentRotate >= limitRotateA && currentRotate <= limitRotateB) {// 缩放从 0 到 1const rValue = (currentRotate - limitRotateA) / (limitRotateB - limitRotateA);dot.setAttribute('r', `${rValue * 10}`);} else if (currentRotate >= limitRotateB && currentRotate <= 360) {// 保持 10 不变dot.setAttribute('r', `10`);}});dotObserver.observe(dot, { attributes: true, attributeFilter: ['style'] });// 创建线段(上牙膛)const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');line.setAttribute('x1', '100');line.setAttribute('y1', '100');line.setAttribute('x2', '200');line.setAttribute('y2', '100');line.setAttribute('stroke', 'white');line.setAttribute('stroke-width', '2');line.style.transformOrigin = 'center';// 创建圆弧(鼻子)(头盔)const arc = document.createElementNS('http://www.w3.org/2000/svg', 'path');arc.setAttribute('fill', 'none');arc.setAttribute('stroke', '#c8ff00');arc.setAttribute('stroke-width', '2');arc.style.transformOrigin = 'center';const arcAngle = 360;// 更新圆弧的 d 属性function updateArc(arcX, arcY, arcRadius, arcAngle) {if (arcAngle === 360) {// 圆弧不能画整圆, 但是可以差一点点const arcRadians2 = (arcAngle - 1e-5) * (Math.PI / 180);const newarcX2 = arcX + arcRadius * Math.cos(arcRadians2);const newarcY2 = arcY - arcRadius * Math.sin(arcRadians2);const arc_dm1 = `M ${arcX + arcRadius},${arcY}`;const arc_da1 = `A ${arcRadius},${arcRadius} 0 ${arcAngle > 180 ? '1':'0'},0 ${newarcX2},${newarcY2}`;arc.setAttribute('d', `${arc_dm1} ${arc_da1}`);return;}const arcRadians = arcAngle * (Math.PI / 180);const newarcX = arcX + arcRadius * Math.cos(arcRadians);const newarcY = arcY - arcRadius * Math.sin(arcRadians);const arc_dm1 = `M ${arcX + arcRadius},${arcY}`;const arc_da1 = `A ${arcRadius},${arcRadius} 0 ${arcAngle > 180 ? '1':'0'},0 ${newarcX},${newarcY}`;arc.setAttribute('d', `${arc_dm1} ${arc_da1}`);}updateArc(100, 100, 99, arcAngle);// 根据旋转值设置半径const arcObserver = new MutationObserver((mutations) => {// 获取元素的当前旋转值const currentRotate = parseFloat(getComputedStyle(arc).getPropertyValue('rotate')) || 0;// 根据旋转值限制角度大小不超过身体(arc 的角度范围是 180 度到 360 度)updateArc(100, 100, 99, Math.min((currentRotate - 180) * 2, arcAngle));// updateArc(100, 100, 99, (currentRotate - 180) * 2);});arcObserver.observe(arc, { attributes: true, attributeFilter: ['style'] });// 创建滑块和角度显示const sliderDiv = document.createElement('div');const sliderText = document.createTextNode('拖动滑块控制吃豆人的张嘴角度:');sliderDiv.style.width = '400px';const slider = document.createElement('input');slider.type = 'range';slider.min = '0';slider.max = '360';slider.value = 270;const angleDisplay = document.createElement('span');// angleDisplay.textContent = `${360 - slider.value}度`;sliderDiv.appendChild(sliderText);sliderDiv.appendChild(angleDisplay);sliderDiv.appendChild(slider);// 添加所有元素到容器container.appendChild(svg);container.appendChild(sliderDiv);svg.appendChild(circle);svg.appendChild(dot);svg.appendChild(line);svg.appendChild(arc);// 更新圆形的 dash 长度和偏移量,以及 circle 和 dot 的 rotateconst updateCircle = () => {const angle = slider.value;angleDisplay.textContent = `${360 - angle}`;const circumference = 100 * Math.PI;const dashOffset = circumference / 360 * (360 - angle);circle.setAttribute('stroke-dasharray', circumference);circle.setAttribute('stroke-dashoffset', dashOffset);// 更新 circle 和 dot 的 rotate 属性circle.style.rotate = `${180 - angle / 2}deg`;dot.style.rotate = `${180 + angle / 2}deg`;line.style.rotate = `${180 + angle / 2}deg`;arc.style.rotate = `${180 + angle / 2}deg`;};// 初始更新updateCircle();// 添加滑块事件监听器let animationFrameId;slider.addEventListener('input', () => {if (animationFrameId) {cancelAnimationFrame(animationFrameId);}animationFrameId = requestAnimationFrame(updateCircle);});// slider.addEventListener('input', updateCircle);});</script>
</body>
</html>

相关文章:

纯CSS吃豆人(JS仅控制进度)

一、效果展示 二、源码 html <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Pac-Man SVG Demo…...

redis 数据类型新手练习系列——Hash类型

redis 数据类型 Redis 主要支持以下几种数据类型&#xff1a; &#xff08;1&#xff09;string&#xff08;字符串&#xff09;: 基本的数据存储单元&#xff0c;可以存储字符串、整数或者浮点数。 &#xff08;2&#xff09;hash&#xff08;哈希&#xff09;:一个键值对集…...

如何使用@KafkaListener实现从nacos中动态获取监听的topic

1、简介 对于经常需要变更kafka主题的场景&#xff0c;为了实现动态监听topic的功能&#xff0c;可以使用以下方式。 2、使用步骤 2.1、添加依赖 <dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka</artifactI…...

区块链如何达成共识:PoW/PoS/DPoS的原理、争议与适用场景全解

引言 区块链技术的核心在于​​去中心化网络中的信任机制​​&#xff0c;而共识算法是实现这一目标的关键。不同的共识机制在效率、安全性、去中心化程度等方面各有取舍。本文将深入解析三种主流共识机制——​​工作量证明&#xff08;PoW&#xff09;​​、​​权益证明&am…...

Oracle for Linux安装和配置(11)——Oracle安装和配置

11.3. Oracle安装和配置 Linux上Oracle的安装及配置与Windows上差不多,只是安装软件的准备等有所不同,下面只对不同于Windows的部分进行较为详细的讲解,其他类似部分不再赘述。另外,无论选择使用虚机还是物理机,Oracle安装、配置和使用等方面几乎都是完全一样的。 11.3.…...

http协议详解附带c/c++服务器和客户端源码

http详解 代码部分HTTP请求结构示例HTTP客户端实现&#xff08;使用Linux系统调用&#xff09;简易HTTP服务器实现 深入解析HTTP协议&#xff1a;从基础到实践1. HTTP协议核心概念1.1 协议本质解读1.2 通信模型详解 2. 抓包分析实战2.1 Fiddler工具妙用2.2 报文结构拆解 3. 请求…...

JavaScript性能优化实战(5):数据结构与算法性能优化

JavaScript中常用数据结构性能对比 数据结构的选择对JavaScript应用的性能有着决定性的影响。不同的数据结构在不同操作上各有优劣,选择合适的数据结构能显著提升应用性能。本节将对JavaScript中常用的数据结构进行全面的性能对比分析。 基本数据结构时间复杂度概览 首先,…...

uniapp小程序开发入门01-快速搭建一个空白的项目并预览它

uniapp小程序开发入门01-快速搭建一个空白的项目并预览它&#xff01;由于近期有市场需求和计划&#xff0c;构建一套自己的小程序&#xff0c;所以再次带领大家系统的过一遍&#xff0c;如何使用uniapp程序快速构建一套完整的项目。今天是第一小节&#xff0c;带领大家快速构建…...

UR5 UR5e机器人URDF文件

URDF全称为Unified Robot Description Format,中文可以翻译为“统一机器人描述格式”。与计算机文件中的.txt文本格式、.jpg图像格式等类似,URDF是一种基于XML规范、用于描述机器人结构的格式。根据该格式的设计者所言,设计这一格式的目的在于提供一种尽可能通用(as genera…...

ubuntu20.04安装x11vnc远程桌面

x11vnc是一个VNC服务器, 安装后我们可以不依赖外部的显示设备, 通过网络远程登录ubuntu桌面。 安装x11vnc sudo apt-get install x11vnc 设置VNC登录密码 sudo x11vnc -storepasswd /etc/x11vnc.pwd 设置x11vnc在开机时自动启动 新建如下文件: sudo vi /lib/systemd/sys…...

AKM旭化成微电子全新推出能量收集IC“AP4413系列”

旭化成微电子开始批量生产用于环保发电的电荷控制集成电路&#xff01;优化充电电池的充放电&#xff0c;广泛应用于智能遥控器和蓝牙TMTag等设备。 01 概述 旭化成微电子株式会社&#xff08;AKM&#xff09;开发出面向小型二次电池&#xff08;充电电池&#xff09;的环境…...

机器人行业研究系列报告

新质生产力系列报告&#xff1a;2024年人形机器人核心场景发展洞察研究报告 具身机器人行业现状及未来趋势分析 2025 2025年人形机器人投资策略&#xff0c;量产元年&#xff0c;全球共振&#xff0c;百家争鸣 人形机器人行业深度报告&#xff08;一&#xff09;&#xff1a…...

利用JMeter代理服务器方式实现高效压测

前言 在当今快节奏的互联网时代&#xff0c;确保Web应用和服务能够在高负载下稳定运行变得至关重要。无论是电子商务平台、社交媒体网络还是在线教育服务&#xff0c;用户对网站响应速度和稳定性的期望从未如此之高。因此&#xff0c;性能测试不再是一个可选项&#xff0c;而是…...

NLP高频面试题(五十五)——DeepSeek系列概览与发展背景

大型模型浪潮背景 近年来,大型语言模型(Large Language Model, LLM)领域发展迅猛,从GPT-3等超大规模模型的崛起到ChatGPT的横空出世,再到GPT-4的问世,模型参数规模和训练数据量呈指数级增长。以GPT-3为例,参数高达1750亿,在570GB文本数据上训练,显示出模型规模、数据…...

2015-2023 各省 GDP 数据,用QuickBI 进行数据可视化——堆叠图!

嘿&#xff0c;数据爱好者们&#xff01;今天咱要来一场刺激的数据冒险&#xff0c;深入剖析全国各省的 GDP 数据&#xff0c;而且会借助强大的 QuickBI 工具&#xff0c;用超酷炫的堆叠图让这些数据 “活” 起来&#xff0c;带你一眼看清经济格局&#xff01; 地址&#xff1…...

MySQL优化(持续更新)笔记

一、insert优化 &#xff1a; 之前&#xff1a;项目通常是一条insert一条的执行&#xff0c;每一次都需要与MySQL进行建立连接进行网络传输&#xff0c;效率很低 现在&#xff1a; 1.- 批量插入&#xff08;一条sql就行&#xff0c;一次500-1000&#xff09; 可以与MyBatis…...

MySQL表的操作 -- 表的增删改查

目录 1. 表的创建2. 表的查看3. 表的修改4. 表的删除5. 总结 1. 表的创建 1.查看字符集及效验规则 2. 表的创建 CREATE TABLE table_name ( field1 datatype, field2 datatype, field3 datatype ) character set 字符集 collate 校验规则 engine 存储引擎;创建用户表1 创建用…...

Java 数组:深度解析

前言 数组作为Java中最基础也是最强大的数据结构之一,其高效性和灵活性在性能关键型应用中无可替代。本文将从进阶使用开始,逐步深入探索Java数组的高级特性和大师级技巧,帮助开发者全面掌握数组技术的精髓。 一、数组基础回顾与性能特性 1.1 数组基本特性对比 特性Java数…...

【基于Qt的QQMusic项目演示第一章】从界面交互到核心功能实现

&#x1f339; 作者: 云小逸 &#x1f91f; 个人主页: 云小逸的主页 &#x1f91f; motto: 要敢于一个人默默的面对自己&#xff0c;强大自己才是核心。不要等到什么都没有了&#xff0c;才下定决心去做。种一颗树&#xff0c;最好的时间是十年前&#xff0c;其次就是现在&…...

[Mybatis-plus]

简介 MyBatis-Plus &#xff08;简称 MP&#xff09;是一个 MyBatis的增强工具&#xff0c;在 MyBatis 的基础上只做增强不做改变。Mybatis-plus官网地址 注意&#xff0c;在引入了mybatis-plus之后&#xff0c;不要再额外引入mybatis和mybatis-spring&#xff0c;避免因为版本…...

【EDA】EDA中聚类(Clustering)和划分(Partitioning)的应用场景

在VLSI物理设计自动化中&#xff0c;聚类&#xff08;Clustering&#xff09;和划分&#xff08;Partitioning&#xff09;是两个互补但目标和应用场景截然不同的关键步骤&#xff0c;其核心区别如下&#xff1a; 一、应用阶段与核心目标 1. 聚类&#xff08;Clustering&…...

PySide与PyQt对比:为何PySide是更优选择

PySide与PyQt对比&#xff1a;为何PySide是更优选择 引言 在Python桌面应用开发领域&#xff0c;Qt框架的绑定库一直是首选方案。两大主要选择—PySide和PyQt&#xff0c;虽然功能相似&#xff0c;但在许可证、性能和支持方面存在显著差异。本文将深入探讨为何PySide通常是更…...

LVGL移植高通矢量字库GT5SLAD3BFA

字库芯片: GT5SLAD3BFA MCU: STM32F429 LVGL版本&#xff1a;V8.4 一&#xff0c;实现gt_read_data() gt_read_data()函数的作用&#xff1a;与字库flash进行通信&#xff0c;函数的定义里调用spi发送数据和接收数据的接口。用户只需要实现该函数&#xff0c;就可以…...

7.0 sharpScada的sql数据的安装

本文介绍开源库SharpScada的配置过程。 1&#xff0c;还原数据库 2.打开SQL server2014配置启动器&#xff0c;并启用Named Pipes,以及TCP/IP 3.启动SQL Server服务中的SQL Server Browser 4.允许远程连接...

杂项知识点

杂项 1 激活函数1.1 sigmoid1.2 tanh1.3 Relu1.4 leakRelu 1 激活函数 常用的激活函数包括sigmoid tanh Relu leakRelu 1.1 sigmoid import torch import numpy as np import matplotlib.pyplot as plt # sigmoid tanh Relu leakRelu ## 1 sigmoid ### 1.1 代码复现sig…...

Android项目升级插件到kotlin 2.1.0后混淆网络请求异常

背景 项目kt插件1.9.24升级到2.1.0后打包编译release网络请求失败了。 retrofit版本2.9.0 错误详情 java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedTypeat retrofit2.m.a(Unknown Source:2477)at retrofit2.K.invoke(U…...

uniapp 仿企微左边公司切换页

示例代码&#xff1a; <template><view class"container"><!-- 遮罩层 --><view class"mask" v-if"showSidebar" click"closeSidebar"></view><!-- 侧边栏 --><view class"sidebar"…...

Milvus(7):Schema、主字段和自动识别

1 Schema Schema 定义了 Collections 的数据结构。在创建一个 Collection 之前&#xff0c;你需要设计出它的 Schema。本页将帮助你理解 Collections 模式&#xff0c;并自行设计一个示例模式。 在 Zilliz Cloud 上&#xff0c;Collection Schema 是关系数据库中一个表的组合&a…...

Liunx服务上MySQL服务导致CPU炸了,使用kill -9 mysqld进程id后,无法启动MySQL

1.top命令后&#xff0c;可以看到mysqld沾满了cpu 2.然后我使用了kill -9 16594&#xff0c;杀死了mysqld进程 3.之后&#xff0c;查看mysql服务状态&#xff0c;发现对应的 www/serve/mysqld 目录不存在 sudo systemctl status mysqld4.使用命令查看操作 www/serve 目录的历…...

Java使用IText7动态生成带审批文本框的PDF文档

Java使用IText7动态生成带审批文本框的PDF文档 文章目录 Java使用IText7动态生成带审批文本框的PDF文档1.构建第一个框的起始坐标2.渲染第一个框3.渲染其他的审批框 测试结果示例 实现思路 使用Canvas进行相对定位和绝对定位来确定文本框内文字位置&#xff0c;用Rectangle通…...

【音视频】AVIO输入模式

内存IO模式 AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(…...

Android中的多线程

线程池 在编程中经常会使用线程来异步处理任务&#xff0c;但是每个线程的创建和销毁都需要一定的开销。如果每次执行一个任务都需要开一个新线程去执行&#xff0c;则这些线程的创建和销毁将消耗大量的资源。并且线程都是“各自为政”&#xff0c;很难对其进行控制&#xff0c…...

http://noi.openjudge.cn/——2.5基本算法之搜索——200:Solitaire

文章目录 题目宽搜代码总结 题目 总时间限制: 5000ms 单个测试点时间限制: 1000ms 内存限制: 65536kB 描述 Solitaire is a game played on a chessboard 8x8. The rows and columns of the chessboard are numbered from 1 to 8, from the top to the bottom and from left t…...

deep鼠标跟随插件

效果图 实现 首先打开深度系统终端&#xff0c;键入以下安装命令&#xff1a; sudo apt install oneko安装完成后&#xff0c;执行以下命令启动&#xff1a; oneko启动后&#xff0c;就会出现小猫咪&#xff0c;如果终端不关&#xff08;服务不关&#xff09;&#xff0c;会…...

Verilog 语法 (二)

在掌握了 Verilog 的基础语法和常用程序框架之后&#xff0c;本节将带大家深入学习一些 高级设计知识点。这些内容包括&#xff1a; 阻塞赋值&#xff08;&#xff09;与非阻塞赋值&#xff08;<&#xff09;的区别及使用场景&#xff1b; assign 和 always 语句的差异&am…...

大数据开发环境的安装,配置(Hadoop)

1. 三台linux服务器的安装 1. 安装VMware VMware虚拟机软件是一个“虚拟PC”软件&#xff0c;它使你可以在一台机器上同时运行二个或更多Windows、DOS、LINUX系统。与“多启动”系统相比&#xff0c;VMWare采用了完全不同的概念。 我们可以通过VMware来安装我们的linux虚拟机…...

唯创安全:从传统到智能,工厂智能叉车AI防撞系统解决方案

一、叉车安全管理现状痛点分析 1、司机管理难题 • 违规操作频发&#xff1a;无证驾驶、疲劳驾驶(如作业中吸烟/玩手机)及不系安全带现象普遍&#xff0c;事故风险与法律风险双高。 • 资源分配失衡&#xff1a;未经授权使用导致车辆调度混乱&#xff0c;影响作业效率。 2、…...

Windows与CasaOS跨平台文件同步:SyncThing本地部署与同步配置流程

文章目录 前言1. 添加镜像源2. 应用安装测试3. 安装syncthing3.1 更新应用中心3.2 SyncThing安装与配置3.3 Syncthing使用演示 4. 安装内网穿透工具5. 配置公网地址6. 配置固定公网地址 推荐 ​ 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽…...

基于Django的个性化股票交易管理系统

本项目基于Python3.6、Django2.1、MySql8.0&#xff08;最好不要使用5.6&#xff0c;字符集等方面均不兼容&#xff0c;否则导入数据库会出错&#xff09;与股票信息工具包TuShare实现。 创建或激活对应Python开发环境 这里使用了conda来管理环境&#xff0c;强烈推荐&#xf…...

Python图像变清晰与锐化,调整对比度,高斯滤波除躁,卷积锐化,中值滤波钝化,神经网络变清晰

本次使用图片来源于百度 import cv2 import time import numpy as np import pywtfrom PIL import Image, ImageEnhance#-i https://pypi.mirrors.ustc.edu.cn/simpledef super_resolution(input_path, output_path, model_path, scale4):# 初始化超分辨率模型sr cv2.dnn_su…...

带根线就无敌?光纤无人机如何成为电子战的终结者

在硝烟弥漫的俄乌战场上&#xff0c;一条超细光缆正在悄然改变战争规则。2024年俄军首次在前线部署光纤FPV无人机&#xff0c;其通过释放光纤线缆传输数据&#xff0c;成功对乌军装甲目标实施精准打击。乌方同时也迅速跟进&#xff0c;于 2025 年初量产光纤FPV 无人机以突破俄军…...

windows 和ubuntu静态路由配置

目录 windows 1 查看当前路由表 2 添加静态路由 3 删除路由 ubuntu route命令&#xff08;传统方式&#xff09; 使用ip指令&#xff08;推荐&#xff09; ubuntu永久路由配置 子网掩码解释 windows 1 查看当前路由表 -4 只关注ipv4&#xff0c;-6 用于指定显示 IPv6 …...

《深入理解计算机系统》阅读笔记之第四章 处理器体系结构

概述 备注&#xff1a;怎么感觉讲的还是《编码》这本书里面提到的知识点&#xff1f;...

vue项目前后端分离设计

在Vue前端架构中&#xff0c;通过分层结构和模块化设计实现高效的前后端分离&#xff0c;需要系统性规划各层职责、接口管理和数据流控制。以下是结合业界最佳实践的完整方案&#xff1a; 一、分层架构设计 1. 分层结构&#xff08;自上而下&#xff09; 层级职责示例技术实现…...

Steam游戏服务器攻防全景解读——如何构建游戏级抗DDoS防御体系?

Steam游戏服务器的DDoS攻防体系设计&#xff0c;从协议层漏洞利用到业务连续性保障&#xff0c;深度拆解反射型攻击、TCP状态耗尽等7类威胁场景。基于全球15个游戏厂商攻防实战数据&#xff0c;提供包含边缘节点调度、AI流量指纹识别、SteamCMD加固配置的三维防护方案&#xff…...

七、web自动化测试03

目录 一、xpath定位1. 属性定位2.属性与逻辑结合3. 属性与层级结合 二、cookie1. 验证码处理方案2. cookie3. 案例&#xff1a;cookie跳过登录 三、pytest1. 介绍及安装2. 定义用例3. 执行测试用例3.1 命令行运行3.2 配置文件运行3.3 项目配置文件config.py 4. 参数化5. 断言6.…...

企业级AI开发利器:Spring AI框架深度解析与实战

企业级AI开发利器&#xff1a;Spring AI框架深度解析与实战 一、前言&#xff1a;Java生态的AI新纪元 在人工智能技术爆发式发展的今天&#xff0c;Java开发者面临着一个新的挑战&#xff1a;如何将大语言模型&#xff08;LLMs&#xff09;和生成式AI&#xff08;GenAI&#…...

docker-compose安装RustDesk远程工具

以下是使用 docker-compose 部署 RustDesk 服务端(ID服务器 hbbs + 中继服务器 hbbr)的完整流程: 1. 创建 docker-compose.yml mkdir -p ~/rustdesk && cd ~/rustdesk vi docker-compose.ymlversion: 3.8services...

Qt基础009(HTTP编程和QJSON)

文章目录 软件开发网络架构BS架构/CS架构 HTTP基本概念QT的HTTP编程JSON数据概述QT生成JSON数据QT解析JSON数据 软件开发网络架构 BS架构/CS架构 ​ 在计算机网络和软件开发中&#xff0c;CS架构&#xff08;Client-Server Architecture&#xff0c;客户端-服务器架构&#x…...

学习整理在centos7上安装mysql8.0版本教程

学习整理在centos7上安装mysql8.0版本教程 查看linux系统版本下载mysql数据库安装环境检查解压mysql安装包创建MySQL需要的目录及授权新增用户组新增组用户配置mysql环境变量编写MySQL配置文件初始化数据库初始化msyql服务启动mysql修改初始化密码配置Linux 系统服务工具,使My…...