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

Web网页开发——水果忍者

1.介绍

复刻经典小游戏——水果忍者

2.预览

在这里插入图片描述

3.代码

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Fruit Ninja Web Demo</title><style>body {margin: 0;padding: 0;overflow: hidden;background-color: #333;font-family: Arial, sans-serif;touch-action: none;}#gameCanvas {background-color: #87CEEB;display: block;margin: 0 auto;max-width: 100%;max-height: 100vh;}#gameContainer {position: relative;width: 100%;height: 100vh;display: flex;flex-direction: column;align-items: center;justify-content: center;}#startScreen, #gameOverScreen {position: absolute;top: 0;left: 0;width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;background-color: rgba(0, 0, 0, 0.7);color: white;z-index: 10;}#gameOverScreen {display: none;}button {background-color: #4CAF50;border: none;color: white;padding: 15px 32px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;border-radius: 5px;}.scoreBoard {position: absolute;top: 10px;left: 10px;color: white;font-size: 24px;z-index: 5;text-shadow: 2px 2px 4px black;}.comboText {position: absolute;color: yellow;font-size: 36px;font-weight: bold;text-shadow: 2px 2px 4px black;opacity: 1;transition: opacity 1s, transform 1s;z-index: 5;}</style>
</head>
<body><div id="gameContainer"><div id="startScreen"><h1>Fruit Ninja Web Demo</h1><p>Slice fruits with your mouse or finger to score points!</p><p>Avoid bombs or you'll lose!</p><button id="startButton">Start Game</button></div><canvas id="gameCanvas"></canvas><div id="gameOverScreen"><h1>Game Over</h1><p>Your Score: <span id="finalScore">0</span></p><button id="restartButton">Play Again</button></div><div class="scoreBoard">Score: <span id="scoreDisplay">0</span></div></div><script>// Game variablesconst canvas = document.getElementById('gameCanvas');const ctx = canvas.getContext('2d');const startScreen = document.getElementById('startScreen');const gameOverScreen = document.getElementById('gameOverScreen');const startButton = document.getElementById('startButton');const restartButton = document.getElementById('restartButton');const scoreDisplay = document.getElementById('scoreDisplay');const finalScore = document.getElementById('finalScore');let score = 0;let gameActive = false;let gameObjects = [];let sliceTrail = [];let sliceActive = false;let lastTimestamp = 0;let spawnTimer = 0;let comboCount = 0;let comboTimer = 0;// Resize canvasfunction resizeCanvas() {canvas.width = window.innerWidth;canvas.height = window.innerHeight;}// Initialize gamefunction initGame() {resizeCanvas();score = 0;gameObjects = [];sliceTrail = [];sliceActive = false;scoreDisplay.textContent = score;gameActive = true;lastTimestamp = 0;spawnTimer = 0;// Start animationrequestAnimationFrame(gameLoop);}// Game objects classesclass GameObject {constructor(x, y, type) {this.x = x;this.y = y;this.type = type;this.sliced = false;this.velocityX = Math.random() * 8 - 4;this.velocityY = -15 - Math.random() * 5;this.gravity = 0.5;this.rotation = 0;this.rotationSpeed = Math.random() * 0.1 - 0.05;this.size = 40 + Math.random() * 20;if (this.type === 'banana') {this.color = '#FFD700';} else if (this.type === 'bomb') {this.color = '#333';this.size = 30 + Math.random() * 10;} else if (this.type === 'pomegranate') {this.color = '#FF4500';this.size = 50 + Math.random() * 10;} else if (this.type === 'watermelon') {this.color = '#32CD32';this.size = 60 + Math.random() * 10;} else {// Default applethis.color = '#FF0000';}this.slicedColor1 = this.color;this.slicedColor2 = this.type === 'watermelon' ? '#FF6347' : this.color;// For slice animationthis.sliceAngle = 0;this.slicePart1 = { x: 0, y: 0, vx: 0, vy: 0, rotation: 0 };this.slicePart2 = { x: 0, y: 0, vx: 0, vy: 0, rotation: 0 };}update() {if (this.sliced) {// Update sliced partsthis.slicePart1.x += this.slicePart1.vx;this.slicePart1.y += this.slicePart1.vy;this.slicePart1.vy += this.gravity;this.slicePart1.rotation += 0.05;this.slicePart2.x += this.slicePart2.vx;this.slicePart2.y += this.slicePart2.vy;this.slicePart2.vy += this.gravity;this.slicePart2.rotation += 0.05;return this.slicePart1.y < canvas.height && this.slicePart2.y < canvas.height;} else {// Update normal objectthis.x += this.velocityX;this.y += this.velocityY;this.velocityY += this.gravity;this.rotation += this.rotationSpeed;return this.y < canvas.height + 100;}}draw() {ctx.save();if (this.sliced) {// Draw first slice partctx.save();ctx.translate(this.slicePart1.x, this.slicePart1.y);ctx.rotate(this.slicePart1.rotation);ctx.beginPath();ctx.arc(0, 0, this.size / 2, 0, Math.PI, false);ctx.fillStyle = this.slicedColor1;ctx.fill();if (this.type === 'watermelon') {ctx.beginPath();ctx.arc(0, 0, this.size / 2 - 5, 0, Math.PI, false);ctx.fillStyle = this.slicedColor2;ctx.fill();}ctx.restore();// Draw second slice partctx.save();ctx.translate(this.slicePart2.x, this.slicePart2.y);ctx.rotate(this.slicePart2.rotation);ctx.beginPath();ctx.arc(0, 0, this.size / 2, Math.PI, 2 * Math.PI, false);ctx.fillStyle = this.slicedColor1;ctx.fill();if (this.type === 'watermelon') {ctx.beginPath();ctx.arc(0, 0, this.size / 2 - 5, Math.PI, 2 * Math.PI, false);ctx.fillStyle = this.slicedColor2;ctx.fill();}ctx.restore();} else {// Draw normal objectctx.translate(this.x, this.y);ctx.rotate(this.rotation);if (this.type === 'bomb') {// Draw bombctx.beginPath();ctx.arc(0, 0, this.size / 2, 0, 2 * Math.PI);ctx.fillStyle = this.color;ctx.fill();// Draw fusectx.beginPath();ctx.moveTo(0, -this.size / 2);ctx.quadraticCurveTo(10, -this.size / 2 - 15, 20, -this.size / 2 - 10);ctx.lineWidth = 3;ctx.strokeStyle = '#8B4513';ctx.stroke();} else if (this.type === 'banana') {// Draw bananactx.beginPath();ctx.arc(0, 0, this.size / 2, 0.3 * Math.PI, 1.7 * Math.PI);ctx.lineWidth = this.size / 2;ctx.strokeStyle = this.color;ctx.stroke();} else if (this.type === 'watermelon') {// Draw watermelonctx.beginPath();ctx.arc(0, 0, this.size / 2, 0, 2 * Math.PI);ctx.fillStyle = '#32CD32';ctx.fill();// Inner partctx.beginPath();ctx.arc(0, 0, this.size / 2 - 5, 0, 2 * Math.PI);ctx.fillStyle = '#FF6347';ctx.fill();// Seedsctx.fillStyle = 'black';for (let i = 0; i < 8; i++) {const angle = i * (Math.PI / 4);const distance = this.size / 4;ctx.beginPath();ctx.ellipse(Math.cos(angle) * distance,Math.sin(angle) * distance,3, 5, angle, 0, 2 * Math.PI);ctx.fill();}} else if (this.type === 'pomegranate') {// Draw pomegranatectx.beginPath();ctx.arc(0, 0, this.size / 2, 0, 2 * Math.PI);ctx.fillStyle = this.color;ctx.fill();// Crownctx.beginPath();ctx.moveTo(-10, -this.size / 2);ctx.lineTo(10, -this.size / 2);ctx.lineTo(0, -this.size / 2 - 10);ctx.closePath();ctx.fillStyle = '#8B4513';ctx.fill();} else {// Draw applectx.beginPath();ctx.arc(0, 0, this.size / 2, 0, 2 * Math.PI);ctx.fillStyle = this.color;ctx.fill();// Stemctx.beginPath();ctx.moveTo(0, -this.size / 2);ctx.lineTo(0, -this.size / 2 - 7);ctx.lineWidth = 3;ctx.strokeStyle = '#8B4513';ctx.stroke();}}ctx.restore();}checkSlice(slicePath) {if (this.sliced) return false;// Check if the slice path intersects with the objectfor (let i = 1; i < slicePath.length; i++) {const x1 = slicePath[i-1].x;const y1 = slicePath[i-1].y;const x2 = slicePath[i].x;const y2 = slicePath[i].y;// Calculate distance from line segment to center of objectconst distance = distToSegment(this.x, this.y, x1, y1, x2, y2);if (distance < this.size / 2) {// Calculate slice anglethis.sliceAngle = Math.atan2(y2 - y1, x2 - x1);// Set the slice partsthis.slicePart1.x = this.x;this.slicePart1.y = this.y;this.slicePart1.vx = this.velocityX - 1 + Math.random() * 2;this.slicePart1.vy = this.velocityY - 2;this.slicePart2.x = this.x;this.slicePart2.y = this.y;this.slicePart2.vx = this.velocityX + 1 + Math.random() * 2;this.slicePart2.vy = this.velocityY - 2;this.sliced = true;// Handle special fruitsif (this.type === 'bomb') {return 'bomb';} else if (this.type === 'banana') {return 'banana';} else if (this.type === 'pomegranate') {return 'pomegranate';} else {return 'fruit';}}}return false;}}// Helper function to calculate distance from point to line segmentfunction sqr(x) { return x * x; }function dist2(v, w) { return sqr(v.x - w.x) + sqr(v.y - w.y); }function distToSegmentSquared(p, v, w) {const l2 = dist2(v, w);if (l2 === 0) return dist2(p, v);let t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;t = Math.max(0, Math.min(1, t));return dist2(p, {x: v.x + t * (w.x - v.x),y: v.y + t * (w.y - v.y)});}function distToSegment(px, py, x1, y1, x2, y2) {return Math.sqrt(distToSegmentSquared({x: px, y: py}, {x: x1, y: y1}, {x: x2, y: y2}));}// Spawn new game objectsfunction spawnObjects() {const types = ['apple', 'watermelon', 'banana', 'pomegranate'];const x = Math.random() * canvas.width;const y = canvas.height + 20;// 20% chance to spawn a bombif (Math.random() < 0.2) {gameObjects.push(new GameObject(x, y, 'bomb'));} else {const type = types[Math.floor(Math.random() * types.length)];gameObjects.push(new GameObject(x, y, type));}}// Show combo text animationfunction showComboText(count) {const comboText = document.createElement('div');comboText.className = 'comboText';comboText.textContent = `COMBO x${count}!`;comboText.style.left = `${canvas.width / 2 - 100}px`;comboText.style.top = `${canvas.height / 2 - 50}px`;document.getElementById('gameContainer').appendChild(comboText);setTimeout(() => {comboText.style.opacity = '0';comboText.style.transform = 'translateY(-50px)';setTimeout(() => {comboText.remove();}, 1000);}, 10);}// Spawn small fruits (for pomegranate effect)function spawnSmallFruits(x, y) {const count = 5 + Math.floor(Math.random() * 5);for (let i = 0; i < count; i++) {const fruit = new GameObject(x, y, 'apple');fruit.size = 15 + Math.random() * 10;fruit.velocityX = Math.random() * 10 - 5;fruit.velocityY = -10 - Math.random() * 5;gameObjects.push(fruit);}}// Game loopfunction gameLoop(timestamp) {if (!gameActive) return;// Calculate delta timeconst deltaTime = timestamp - lastTimestamp;lastTimestamp = timestamp;// Clear canvasctx.clearRect(0, 0, canvas.width, canvas.height);// Spawn objectsspawnTimer += deltaTime;if (spawnTimer > 1000) {spawnObjects();spawnTimer = 0;}// Draw slice trailif (sliceActive && sliceTrail.length > 1) {ctx.beginPath();ctx.moveTo(sliceTrail[0].x, sliceTrail[0].y);for (let i = 1; i < sliceTrail.length; i++) {ctx.lineTo(sliceTrail[i].x, sliceTrail[i].y);}ctx.strokeStyle = 'white';ctx.lineWidth = 5;ctx.lineCap = 'round';ctx.lineJoin = 'round';ctx.stroke();// Trail glow effectctx.shadowColor = '#FFF';ctx.shadowBlur = 15;ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)';ctx.lineWidth = 15;ctx.stroke();ctx.shadowBlur = 0;}// Update and draw game objectslet fruitSlicedThisFrame = 0;for (let i = gameObjects.length - 1; i >= 0; i--) {const obj = gameObjects[i];// Check for slicingif (sliceActive && sliceTrail.length > 3 && !obj.sliced) {const sliceResult = obj.checkSlice(sliceTrail);if (sliceResult) {if (sliceResult === 'bomb') {// Game over if bomb is slicedgameActive = false;finalScore.textContent = score;gameOverScreen.style.display = 'flex';return;} else {fruitSlicedThisFrame++;if (sliceResult === 'fruit') {score += 10;} else if (sliceResult === 'banana') {// Banana gives double points for a short timescore += 20;} else if (sliceResult === 'pomegranate') {score += 30;// Spawn small fruitsspawnSmallFruits(obj.x, obj.y);}scoreDisplay.textContent = score;}}}const isVisible = obj.update();if (isVisible) {obj.draw();} else {gameObjects.splice(i, 1);}}// Handle comboif (fruitSlicedThisFrame > 1) {comboCount = fruitSlicedThisFrame;comboTimer = 0;// Add combo bonusconst comboBonus = comboCount * 5;score += comboBonus;scoreDisplay.textContent = score;// Show combo textshowComboText(comboCount);} else if (fruitSlicedThisFrame === 1) {comboTimer += deltaTime;if (comboTimer > 500) {comboCount = 0;}}// Reduce slice trail graduallyif (sliceTrail.length > 0 && !sliceActive) {sliceTrail.shift();}// Continue animationrequestAnimationFrame(gameLoop);}// Event listeners for mouse/touchcanvas.addEventListener('mousedown', (e) => {sliceActive = true;sliceTrail = [];sliceTrail.push({x: e.clientX,y: e.clientY});});canvas.addEventListener('mousemove', (e) => {if (sliceActive) {sliceTrail.push({x: e.clientX,y: e.clientY});// Limit trail lengthif (sliceTrail.length > 20) {sliceTrail.shift();}}});canvas.addEventListener('mouseup', () => {sliceActive = false;});canvas.addEventListener('mouseleave', () => {sliceActive = false;});// Touch eventscanvas.addEventListener('touchstart', (e) => {e.preventDefault();sliceActive = true;sliceTrail = [];sliceTrail.push({x: e.touches[0].clientX,y: e.touches[0].clientY});});canvas.addEventListener('touchmove', (e) => {e.preventDefault();if (sliceActive) {sliceTrail.push({x: e.touches[0].clientX,y: e.touches[0].clientY});// Limit trail lengthif (sliceTrail.length > 20) {sliceTrail.shift();}}});canvas.addEventListener('touchend', (e) => {e.preventDefault();sliceActive = false;});// Button event listenersstartButton.addEventListener('click', () => {startScreen.style.display = 'none';initGame();});restartButton.addEventListener('click', () => {gameOverScreen.style.display = 'none';initGame();});// Handle window resizewindow.addEventListener('resize', resizeCanvas);// Initial setupresizeCanvas();</script>
</body>
</html>

相关文章:

Web网页开发——水果忍者

1.介绍 复刻经典小游戏——水果忍者 2.预览 3.代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title&…...

51 单片机中断控制寄存器 TCON

在 51 单片机中&#xff0c;中断控制寄存器 TCON&#xff08;Timer/Counter Control Register&#xff0c;定时器 / 计数器控制寄存器&#xff09;主要用于控制定时器 / 计数器的启动、停止以及外部中断的触发方式等。它既可以按字节寻址&#xff0c;也可以按位寻址&#xff0c…...

电脑如何在系统默认的壁纸中切换自己喜欢的

1、声明&#xff1a;该切换壁纸仅支持win10。 当你想去切换系统默认的壁纸&#xff0c;但是不知道该怎么切换&#xff0c;别慌&#xff0c;小亦教你几招帮你快速切换自定义壁纸。 我们平常使用的win10桌面壁纸大部分都是 简单、朴素的壁纸&#xff0c;但如果你想要切换自己喜…...

AcWing 600. 仰视奶牛 单调栈模板题

https://www.acwing.com/problem/content/description/602/ 找x右边第一个大于x的数的位置 const int N 1e5 10,T 20;int n; LL a[N],stk[N],top,r[N];void solve() {cin >> n;for (int i 1;i < n;i ) cin >> a[i];for (int i n;i > 1;i --){while(top…...

使用Galaxy创建生物信息学工作流的步骤详解

李升伟 整理 Galaxy 是一个基于 Web 的生物信息学平台&#xff0c;提供了直观的用户界面和丰富的工具&#xff0c;帮助用户创建和管理生物信息学工作流。以下是使用 Galaxy 创建生物信息学工作流的主要步骤&#xff1a; 1. 访问 Galaxy 平台 打开 Galaxy 的官方网站&#xff…...

OmniDrive(2):环境搭建

文章目录 1. 环境安装1.1 cuda 和cudnn安装1.2 依赖包安装2. 准备数据集及权重2.1 下载nuScenes数据2.2 下载预训练权重3. 模型训练及推理3.1 训练3.2 推理根据OmniDrive 官方的环境配置 Environment Setup python 3.9 ubantu 22.04 cuda 11.7 torch1.13.11. 环境安装 1.1 cu…...

计算机底层知识一——从编程语言到可执行程序

好久没写博客了&#xff0c;近段时间事情比较杂&#xff0c;最近终于有时间回归了。其余代码写久了就会遇到许多奇奇怪怪的问题&#xff0c;这些问题绕不开许多底层知识&#xff0c;比如缺少动态依赖库、idea编译失败等等&#xff0c;虽然通过百度等搜索引擎&#xff0c;亦或是…...

HarmonyOS Next~鸿蒙系统ArkCompiler跨平台编译技术的革新实践

HarmonyOS Next~鸿蒙系统ArkCompiler跨平台编译技术的革新实践 引言 在万物互联时代&#xff0c;操作系统对编译技术的需求已从单纯的代码转换演变为跨设备协同、高效资源调度与极致性能优化的综合挑战。华为鸿蒙系统&#xff08;HarmonyOS&#xff09;自主研发的ArkCompiler…...

Ubuntu 下 nginx-1.24.0 源码分析 - ngx_cycle_modules

声明在 src/core/ngx_module.h ngx_int_t ngx_cycle_modules(ngx_cycle_t *cycle);实现在 src/core/ngx_module.c ngx_int_t ngx_cycle_modules(ngx_cycle_t *cycle) {/** create a list of modules to be used for this cycle,* copy static modules to it*/cycle->modul…...

Java多线程与高并发专题——关于CopyOnWrite 容器特点

引入 在 CopyOnWriteArrayList 出现之前&#xff0c;我们已经有了 ArrayList 和 LinkedList 作为 List 的数组和链表的实现&#xff0c;而且也有了线程安全的 Vector 和Collections.synchronizedList() 可以使用。 首先我们来看看Vector是如何实现线程安全的 &#xff0c;还是…...

Wpf-ReactiveUI-Usercontrol与主界面交互

文章目录 Usercontrol与主界面方法一、使用属性绑定UserControl 部分(MyUserControl.xaml.cs)UserControl 视图模型部分(MyUserControlViewModel.cs)主界面部分(MainWindow.xaml)主界面视图模型部分(MainWindowViewModel.cs)方法二、使用消息传递UserControl 视图模型部…...

MySQL中like模糊查询如何优化?

大家好&#xff0c;我是锋哥。今天分享关于【MySQL中like模糊查询如何优化?】面试题。希望对大家有帮助&#xff1b; MySQL中like模糊查询如何优化? 1000道 互联网大厂Java工程师 精选面试题-Java资源分享网 在 MySQL 中&#xff0c;LIKE 模糊查询虽然非常常见&#xff0c;…...

用Ruby的Faraday库来进行网络请求抓取数据

在 Ruby 中&#xff0c;Faraday 是一个非常强大的 HTTP 客户端库&#xff0c;它可以用于发送 HTTP 请求并处理响应。你可以使用 Faraday 来抓取网页数据&#xff0c;处理 API 请求等任务。下面我将向你展示如何使用 Faraday 库进行网络请求&#xff0c;抓取数据并处理响应。 1.…...

2025天梯训练1

PTA | L3-1 直捣黄龙 30分 思路&#xff1a;多关键字最短路&#xff0c;同时还要记录最短路径条数。 typedef struct node{int from,d,pass,kl;bool operator<(const node &x)const{if(d!x.d) return d>x.d;if(pass!x.pass) return pass<x.pass;return kl<x.…...

DeepSeek教我写词典爬虫获取单词的音标和拼写

Python在爬虫领域展现出了卓越的功能性&#xff0c;不仅能够高效地抓取目标数据&#xff0c;还能便捷地将数据存储至本地。在众多Python爬虫应用中&#xff0c;词典数据的爬取尤为常见。接下来&#xff0c;我们将以dict.cn为例&#xff0c;详细演示如何编写一个用于爬取词典数据…...

揭开AI-OPS 的神秘面纱 第四讲 AI 模型服务层(自研方向)

AI 模型服务层技术架构与组件选型分析(自研方向) 基于自有开发寻训练方向 AI 模型服务层 是 AI-Ops 架构的 核心智能引擎,负责构建、训练、部署、管理和监控各种 AI 模型,为上层应用服务层提供智能分析和决策能力。 AI 模型服务层需要提供一个灵活、可扩展、高性能的平台…...

[通俗易懂C++]:std::optional

[通俗易懂C]:std::optional 考虑下面这样一个函数: int doIntDivision(int x, int y) {return x / y; }如果调用者传入一个语义上无效的值&#xff08;例如 y 0 &#xff09;&#xff0c;此函数无法计算一个返回值&#xff08;因为除以 0 在数学上是未定义的&#xff09;。在…...

深入理解与配置 Nginx TCP 日志输出

一、背景介绍 在现代网络架构中&#xff0c;Nginx 作为一款高性能的 Web 服务器和反向代理服务器&#xff0c;广泛应用于各种场景。除了对 HTTP/HTTPS 协议的出色支持&#xff0c;Nginx 从 1.9.0 版本开始引入了对 TCP 和 UDP 协议的代理功能&#xff0c;这使得它在处理数据库…...

使用 vxe-table 导出 excel,支持带数值、货币、图片等带格式导出

使用 vxe-table 导出 excel&#xff0c;支持带数值、货币、图片等带格式导出&#xff0c;通过官方自动的导出插件 plugin-export-xlsx 实现导出功能 查看官网&#xff1a;https://vxetable.cn gitbub&#xff1a;https://github.com/x-extends/vxe-table gitee&#xff1a;htt…...

Spring-事务

Spring 事务 事务的基本概念 &#x1f539; 什么是事务&#xff1f; 事务是一组数据库操作&#xff0c;它们作为一个整体&#xff0c;要么全部成功&#xff0c;要么全部回滚。 常见的事务场景&#xff1a; 银行转账&#xff08;扣款和存款必须同时成功&#xff09; 订单系统…...

开源项目介绍:Native-LLM-for-Android

项目地址&#xff1a;Native-LLM-for-Android 创作活动时间&#xff1a;2025年 支持在 Android 设备上运行大型语言模型 &#xff08;LLM&#xff09; &#xff0c;具体支持的模型包括&#xff1a; DeepSeek-R1-Distill-Qwen: 1.5B Qwen2.5-Instruct: 0.5B, 1.5B Qwen2/2.5VL:…...

vocabulary is from your listening,other speaking and your thought.

不要把单词放在自己的大脑里&#xff0c;放在自己的嘴巴里&#xff0c;自己在那疯狂重复的recite&#xff0c;its futile.只是单点记忆单词&#xff0c;记住也是temporary&#xff0c;而且是单点的记忆&#xff0c;当别人说此词汇&#xff0c;你也听不懂或分辨就是这个单词&…...

前端知识点---路由模式-实例模式和单例模式(ts)

在 ArkTS&#xff08;Ark UI 框架&#xff09;中&#xff0c;路由实例模式&#xff08;Standard Instance Mode&#xff09;主要用于管理页面跳转。当创建一个新页面时&#xff0c;可以选择标准实例模式&#xff08;Standard Mode&#xff09;或单实例模式&#xff08;Single M…...

Matplotlib库中color 参数颜色有多少种

**当我们绘图超过十几种颜色。我都是 定义颜色列表&#xff08; ** colors [blue, green, red, cyan, magenta, yellow, greenyellow, orange, purple, brown, pink, gray]1、 颜色名称 Matplotlib常用的颜色名称&#xff1a; red 或 r green 或 g blue 或 b yellow 或 y cy…...

LINUX虚拟机中,不能播放RTSP设备,怎么办

首先&#xff0c;主机能够打开RTSP设备。虚拟机无法打开。 虚拟机网络设置 桥接网卡&#xff0c;选择正确的网卡。 虚拟机IP设置 需要是同一个网段。交换机的设备是192.168.1.192 用ffplay测试...

宝塔的ssl文件验证域名后,会在域名解析列表中留下记录吗?

在使用宝塔面板进行SSL证书验证域名后&#xff0c;通常不会在域名解析列表中留下记录。验证过程中添加的TXT记录仅用于验证域名的所有权&#xff0c;一旦验证完成&#xff0c;就可以安全地删除这些记录&#xff0c;不会影响SSL证书的正常使用。根据搜索结果&#xff0c;DNS验证…...

mitt 依赖库详解

一、概述 mitt 是一个极其轻量级的 JavaScript 事件发射器库&#xff0c;实现了发布-订阅模式。该模式允许对象间松散耦合&#xff0c;一个对象&#xff08;发布者&#xff09;可以发布事件&#xff0c;而其他对象&#xff08;订阅者&#xff09;可以监听这些事件并作出响应。…...

OSPF网络类型:NBMA与P2MP

一、NBMA网络 NBMA网络的特点 连接方式&#xff1a; 支持多台设备连接到同一个网络段&#xff0c;但网络本身不支持广播或组播。典型例子&#xff1a;帧中继、ATM。 DR/BDR选举&#xff1a; 由于网络不支持广播&#xff0c;OSPF需要手动配置邻居。 仍然会选举DR&#xff08…...

VUE叉的工作原理?

Vuex 是 Vue.js 的一个专门用于状态管理的库&#xff0c;其工作原理基于单向数据流和集中式存储&#xff0c;旨在解决跨组件之间状态共享和管理的复杂性。以下是 Vuex 的核心工作原理及其关键组成部分&#xff1a; 核心概念 State&#xff08;状态&#xff09; Vuex 使用一个单…...

H.264语法结构分析之frame_cropping_flag

技术背景 开发者对接我们轻量级RTSP服务的时候&#xff0c;利用部分开源的播放器&#xff0c;播放流数据的时候&#xff0c;说分辨率不对&#xff0c;导致看到的图像有问题&#xff0c;用我们的player或常见的通用播放器&#xff0c;又都是好的&#xff0c;这就扯到了今天的主…...

【智能体】本地安装Conda和搭建OpenManus环境

整理不易&#xff0c;请不要令色你的赞和收藏。 1. 前言 没体验到 Manus&#xff1f;不妨使用 MetaGPT 开源的 OpenManus 搭建自己的 Manus。本文将带你安装 Conda 并搭建自己的 Manus。 2. 前提条件 已安装 conda&#xff0c;没安装的话&#xff0c;下文有介绍。 OpenManu…...

【linux网络编程】套接字编程API详细介绍

在C语言中&#xff0c;套接字&#xff08;Socket&#xff09;编程主要用于网络通信&#xff0c;尤其是在基于TCP/IP协议的应用程序开发中。常用的套接字编程API主要基于Berkeley Sockets&#xff08;伯克利套接字&#xff09;接口&#xff0c;这些函数通常在<sys/socket.h&g…...

杂项知识笔记搜集

1.pygame pygame可以画出来图形界面&#xff0c;pygame Python仓库 PyGame游戏编程_游戏程序设计csdn-CSDN博客 2.V4L2库 V4L2是Linux上的Camera采集器的框架 Video for Linux &#xff0c;是从Linux2.1版本开始支持的。HDMI视频采集卡采集到的视频通过USB3.0输出&#xff0…...

模型微调——模型性能提升方法及注意事项(自用)

名词补充 人为为训练数据标注的标签称为黄金标准或真实值&#xff0c;这个过程一定程度上保证训练的准确性&#xff0c;但是其人工标注的成本和时间很高&#xff0c;并且标注的标签受人的主观因素影响。 导致模型性能不佳的因素和解决办法 ①不同类别的数据不平衡&#xff1a;统…...

RabbitMQ之旅(1)

相信自己,终会成功 目录 主流MQ产品 1.kafaka 2.RocketMQ 3.RabbitMQ 在xshell上安装RabbitMQ RabbitMQ七种工作模式 1.简单模式 ​编辑 2.工作队列模式 3.发布/订阅模式 4.路由模式 5.通配符模式 6.RPC模式 AMQP.BasicProperties 设置消息属性的类 7.发布确认模…...

TCP7680端口是什么服务

WAF上看到有好多tcp7680端口的访问信息 于是上网搜索了一下&#xff0c;确认TCP7680端口是Windows系统更新“传递优化”功能的服务端口&#xff0c;个人理解应该是Windows利用这个TCP7680端口&#xff0c;直接从内网已经具备更新包的主机上共享下载该升级包&#xff0c;无需从微…...

跟着 Lua 5.1 官方参考文档学习 Lua (11)

文章目录 5.4.1 – PatternsCharacter Class:Pattern Item:Pattern:Captures: string.find (s, pattern [, init [, plain]])例子&#xff1a;string.find 的简单使用 string.match (s, pattern [, init])string.gmatch (s, pattern)string.gsub (s, pattern, repl [, n])例子&…...

<script setup>和export default { setup() { ... } }区别

在 Vue 3 组合式 API&#xff08;Composition API&#xff09;中&#xff0c;<script setup> 和 export default setup() {} 都用于定义组件的逻辑&#xff0c;但它们有一些重要的区别&#xff1a; 1️⃣ <script setup>&#xff08;推荐&#xff09; ✅ 更简洁、…...

leetcode hot100--动态规划【五步总纲】

五步&#xff1a; 1.dp数组以及下标定义 dp[i] 2.递推公式 dp[n]dp[n-1]dp[n-2] 3.dp数组如何初始化 注意&#xff1a;判断边界条件&#xff0c;n0dp[1]就不存在【斐波那契】 4.遍历顺序 for循环顺序 5.打印数组【debug】 第一题&#xff1a;斐波那契数列 首先回顾了…...

RtlLookupAtomInAtomTable函数分析之RtlpAtomMapAtomToHandleEntry函数的作用是验证其正确性

第一部分&#xff1a; NTSTATUS RtlLookupAtomInAtomTable( IN PVOID AtomTableHandle, IN PWSTR AtomName, OUT PRTL_ATOM Atom OPTIONAL ) { NTSTATUS Status; PRTL_ATOM_TABLE p (PRTL_ATOM_TABLE)AtomTableHandle; PRTL_ATOM_TABLE_ENTRY a; …...

【从零开始学习计算机科学】硬件设计与FPGA原理

硬件设计 硬件设计流程 在设计硬件电路之前,首先要把大的框架和架构要搞清楚,这要求我们搞清楚要实现什么功能,然后找找有否能实现同样或相似功能的参考电路板(要懂得尽量利用他人的成果,越是有经验的工程师越会懂得借鉴他人的成果)。如果你找到了的参考设计,最好还是…...

todo: 使用融云imserve做登录(android)

使用融云做登录注册思路 注册界面需要name, email, password考虑到融云注册用户的post格式 POST http://api.rong-api.com/user/getToken.json?userId1690544550qqcom&nameIronman这里的userId可以使用用户的email&#xff0c;但是要截断和 . 符号&#xff0c;即1690544…...

从0开始的操作系统手搓教程23:构建输入子系统——实现键盘驱动1——热身驱动

目录 所以&#xff0c;键盘是如何工作的 说一说我们的8042 输出缓冲区寄存器 状态寄存器 控制寄存器 动手&#xff01; 注册中断 简单整个键盘驱动 Reference ScanCode Table 我们下一步就是准备进一步完善我们系统的交互性。基于这个&#xff0c;我们想到的第一个可以…...

Azure云生态系统详解:核心服务、混合架构与云原生概念

核心服务&#xff1a;深入掌握Azure SQL Database、Azure Database for PostgreSQL、Azure Database for MySQL的架构、备份恢复、高可用性配置&#xff08;如Geo-Replication、自动故障转移组、异地冗余备份&#xff09;。混合架构&#xff1a;熟悉Azure Arc&#xff08;管理混…...

Unity Dots

文章目录 什么是DotsDOTS的优势ECS&#xff08;实体组件系统&#xff09;Job System作业系统Burst编译器最后 什么是Dots DOTS&#xff08;Data-Oriented Technology Stack&#xff09;是Unity推出的一种用于开发高性能游戏和应用的数据导向技术栈&#xff0c;包含三大核心组件…...

SAP DOI EXCEL宏的使用

OAOR里上传EXCEL模版 屏幕初始化PBO创建DOI EXCEL对象&#xff0c;并填充EXCEL内容 *&---------------------------------------------------------------------* *& Module INIT_DOI_DISPLAY_9100 OUTPUT *&--------------------------------------------…...

VSTO(C#)Excel开发3:Range对象 处理列宽和行高

初级代码游戏的专栏介绍与文章目录-CSDN博客 我的github&#xff1a;codetoys&#xff0c;所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。 这些代码大部分以Linux为目标但部分代码是纯C的&#xff0c;可以在任何平台上使用。 源码指引&#xff1a;github源…...

单链表基本操作的实现与解析(补充)

目录 一、引言 二、代码实现 遍历考虑情况 三、操作解析 查找操作&#xff08;sltfind函数&#xff09; 前插操作&#xff08;sltinsert函数&#xff09; 后插操作&#xff08;sltinsertafter函数&#xff09; 前删操作&#xff08;slterase函数&#xff09; 后删操作&…...

电子学会—2024年月6青少年软件编程(图形化)四级等级考试真题——魔法门

魔法门 1.准备工作 (1)保留默认角色小猫和白色背景; (2)添加角色Home Button&#xff0c;复制9个造型&#xff0c;在每个造型上分别加上数字1到9&#xff0c;如下图所示; 2.功能实现 (1)程序开始&#xff0c;依次克隆出五个Home Button&#xff0c;克隆体之间的间距为90; …...

《加快应急机器人发展的指导意见》中智能化升级的思考——传统应急设备智能化升级路径与落地实践

感谢阅读本次内容分享&#xff0c;下面我将解读分析《加快应急机器人发展的指导意见》&#xff0c;喜欢的点赞支持一下呗~(日更真的很辛苦~)&#xff0c;欢迎评论区留言讨论&#xff0c;你们的发言我都会看到~ 《加快应急机器人发展的指导意见》中智能化升级的思考——传统应急…...