Unity照片墙简易圆形交互效果总结

还要很多可以优化的点地方,有兴趣的可以做
比如对象的销毁和生成可以做成对象池,走到最左边后再移动到最右边循环利用

分析过程文件,采用Blender,资源已上传,可以播放动画看效果,下面截个图:
在这里插入图片描述

视频效果如下:

anim

Untiy结构如下:
在这里插入图片描述
上面的ImageItem是我手动添加展示关系用的,默认就一个Target,PictureWall挂PictureWall脚本,ImageItem(预制体)挂ImageItemController 脚本即可

using UnityEngine;public class ImageItemController : MonoBehaviour
{public RectTransform target;public float speed = 10;[SerializeField]private float radiusScale = 1;public float horizontalOffset = 0;private RectTransform rect;private float radius = 0;private Vector2 originalPos = Vector2.zero;private bool isCheck = false;private bool isStartRotate = false;private Vector2 circleCenter;private float xDelta = 0;private float offset = 0;void Start(){rect = transform as RectTransform;rect.anchoredPosition = new Vector2(rect.anchoredPosition.x - horizontalOffset, rect.anchoredPosition.y);radius = target.rect.width * radiusScale;// * Random.Range(0.8f, 1); 半径可以在范围内随机}/* 1.现根据接触点计算出圆的路径:目标移动的位移,计算在圆的的位置,只需修改x即可,y保持不变* 2.计算出的位置x加上移动的距离,得出最总x的位置* 3.设置位置即可* 4.走远时的接触点:开始接触时的关于x对称位置  * 5.添加移动:平移原点和圆点即可*///移动void Update(){if (!isCheck){var dis = Vector2.Distance(target.anchoredPosition, rect.anchoredPosition);if (dis <= radius){isCheck = true;originalPos = rect.anchoredPosition;float y = Mathf.Abs(originalPos.y - target.anchoredPosition.y);float xToCircleCenter = Mathf.Sqrt(radius * radius - y * y);float x = originalPos.x - xToCircleCenter;circleCenter = new Vector2(x, target.anchoredPosition.y);isStartRotate = true;rect.SetSiblingIndex(transform.parent.childCount - 2);}}xDelta = Time.deltaTime * speed;rect.anchoredPosition = new Vector2(rect.anchoredPosition.x - xDelta, rect.anchoredPosition.y);if (isStartRotate){circleCenter.x -= xDelta;originalPos.x -= xDelta;float moveXDistance = target.anchoredPosition.x - circleCenter.x;float x = originalPos.x - circleCenter.x - moveXDistance;float y = Mathf.Sqrt(radius * radius - x * x);float maxY = radius;if (originalPos.y < circleCenter.y){y = -y;maxY = -radius;}Vector2 circlePoint = new Vector2(x, y);if (rect.anchoredPosition.x >= target.anchoredPosition.x){var v1 = circlePoint - (originalPos - circleCenter);var v2 = (originalPos - circleCenter) + new Vector2(0, maxY);v2.Normalize();offset = Vector2.Dot(v1, v2);}else{float tempX = originalPos.x - circleCenter.x;Vector2 originalPos2 = originalPos + 2 * new Vector2(-tempX, 0);var v1 = circlePoint - new Vector2(0, maxY);var v2 = originalPos2 - circleCenter + new Vector2(0, maxY);v2.Normalize();offset = -Vector2.Dot(v1, v2);}if (float.IsNaN(offset)){offset = 0;}x += moveXDistance + offset;Vector2 pos = circleCenter + new Vector2(x, y);rect.anchoredPosition = pos;if (target.anchoredPosition.x >= originalPos.x + originalPos.x - circleCenter.x){rect.anchoredPosition = originalPos;rect.SetAsFirstSibling();}else if (target.anchoredPosition.x <= circleCenter.x){rect.anchoredPosition = originalPos;rect.SetAsFirstSibling();}}if (rect.anchoredPosition.x < -rect.rect.width){Destroy(gameObject);}}
}
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using Utility;public class PictureWall : MonoBehaviour
{[SerializeField]private GameObject prefab;private const float WIDTH = 3072;private const float HEIGHT = 1664;private int row = 6;private int column;private float intervalDistance = 20;[SerializeField]private float offset = 200;private float itemWidth;private float itemHeight;public float speed = 10;private float time = 0;[SerializeField]private RectTransform target;private string path = "/PictureWall/";private List<string> texturePaths;private int currentIndex = 0;private List<Texture2D> textureList;void Start(){textureList = new List<Texture2D>();path = Application.streamingAssetsPath + path;ReadImage();CalculateRowColumn();enabled = false;}private void ReadImage(){if (!Directory.Exists(path)){Directory.CreateDirectory(path);return;}texturePaths = new List<string>();var jpgs = Directory.GetFiles(path, "*.jpg");texturePaths.AddRange(jpgs);texturePaths.Reverse();if (texturePaths.Count > 100){for (int i = texturePaths.Count - 1; i == 100; i--){File.Delete(texturePaths[i]);texturePaths.RemoveAt(i);}}foreach (var filePath in texturePaths){UtilityLoadImage.I.LoadImage(filePath, tex =>{textureList.Add(tex);addNum++;if (addNum == texturePaths.Count){Spawn();}});}}float addNum = 0;private void Spawn(){float x = 0;float y = 0;for (int i = 0; i < row; i++){y = i * (itemHeight + intervalDistance);for (int j = 0; j < column; j++){x = j * (itemWidth + intervalDistance);if (i % 2 != 0){//x -= offset;}RectTransform rect = Instantiate(prefab, transform).transform as RectTransform;rect.pivot = new Vector2(0.5f, 0.5f);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, itemWidth);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, itemHeight);rect.anchoredPosition = new Vector2(x, -y) + new Vector2(rect.rect.width / 2, -rect.rect.height / 2);var controller = rect.GetComponent<ImageItemController>();controller.speed = speed;controller.target = target;if (i % 2 != 0){controller.horizontalOffset = offset;}SetTexture(rect);}}target.SetAsLastSibling();  enabled = true;}private void CalculateRowColumn(){itemHeight = (HEIGHT - (row - 1) * intervalDistance) / row;itemWidth = itemHeight * 16 / 9;//offset = itemWidth / 2;column = (int)(WIDTH / (itemWidth + intervalDistance)) + 3;time = itemWidth / speed;}bool isSpawned = false;private void Update(){if (!isSpawned && transform.childCount <= (column - 1) * row + 1){isSpawned = true;SpawnColumn();}}private void SpawnColumn(){float x = 0;float y = 0;for (int i = 0; i < row; i++){y = i * (itemHeight + intervalDistance);for (int j = 0; j < 1; j++){x = (column - 1) * (itemWidth + intervalDistance);RectTransform rect = Instantiate(prefab, transform).transform as RectTransform;rect.pivot = new Vector2(0.5f, 0.5f);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, itemWidth);rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, itemHeight);rect.anchoredPosition = new Vector2(x, -y) + new Vector2(intervalDistance - Time.deltaTime * speed, -rect.rect.height / 2);var controller = rect.GetComponent<ImageItemController>();controller.speed = speed;controller.target = target;if (i % 2 != 0){controller.horizontalOffset = offset;}SetTexture(rect);}}target.SetAsLastSibling();StartCoroutine(Delay());}private void SetTexture(RectTransform rect){        rect.GetComponent<RawImage>().texture = textureList[currentIndex];currentIndex = (currentIndex + 1) % texturePaths.Count;}private IEnumerator Delay(){//yield return new WaitForSeconds(0.1f);yield return null;isSpawned = false;}
}
工具类
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;namespace Utility
{public class UtilityLoadImage{public class MonoHelper : MonoBehaviour { }public static UtilityLoadImage I;private static MonoHelper helper;static UtilityLoadImage(){var go = new GameObject("UtilityLoadImage");helper = go.AddComponent<MonoHelper>();UnityEngine.Object.DontDestroyOnLoad(go);I = new UtilityLoadImage();}private UtilityLoadImage() { }#region  inner methodprivate IEnumerator LoadTexture2D(string path, Action<Texture2D> callback){           //Debug.Log("path:" + path);           UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(path);yield return uwr.SendWebRequest();if (uwr.downloadHandler.isDone){var tex = DownloadHandlerTexture.GetContent(uwr);callback?.Invoke(tex);}}private void LoadTexture2DByFile(string path, Action<Texture2D> callback){if (path.StartsWith("file://")){var bytes = File.ReadAllBytes(path);Texture2D tex = new Texture2D(1, 1);if (tex.LoadImage(bytes))callback?.Invoke(tex);}}private IEnumerator LoadByte(string path, Action<byte[]> callback){UnityWebRequest uwr = UnityWebRequest.Get(path);yield return uwr.SendWebRequest();if (uwr.downloadHandler.isDone){var data = uwr.downloadHandler.data;callback?.Invoke(data);}}private void DeleteFolder(string savedFolder, bool clearSavedPath, bool isRecursive = false){if (!Directory.Exists(savedFolder)){Debug.LogError("要删除的文件夹不存在!");return;}if (clearSavedPath){Directory.Delete(savedFolder, isRecursive);Directory.CreateDirectory(savedFolder);}}private byte[] Texture2DToByte(string path, Texture2D tex){byte[] data = null;int index = path.LastIndexOf('.');if (index != -1){string expandedName = path.Substring(index + 1);switch (expandedName){case "jpeg":case "jpg":data = tex.EncodeToJPG();break;case "png":data = tex.EncodeToPNG();break;default:Debug.Log("");break;}}else{Debug.Log("path is not correct!!!");}return data;}private IEnumerator LoadAudio(string path, string savedFolder, string fileName, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){File.WriteAllBytes(savedFolder + "/" + fileName, request.downloadHandler.data);AudioClip clip = DownloadHandlerAudioClip.GetContent(request);callback?.Invoke(clip);}}private IEnumerator LoadAudio(string path, string savePath, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){File.WriteAllBytes(savePath, request.downloadHandler.data);AudioClip clip = DownloadHandlerAudioClip.GetContent(request);callback?.Invoke(clip);}}private IEnumerator LoadAudio(string path, Action<AudioClip> callback){UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.MPEG);yield return request.SendWebRequest();if (request.downloadHandler.isDone){AudioClip clip = DownloadHandlerAudioClip.GetContent(request);if (callback != null)callback(clip);elseDebug.Log("加载音频回调为null");}}#endregion#region load and download imagepublic void LoadImage(string path, Action<Texture2D> callback){helper.StartCoroutine(LoadTexture2D(path, callback));}public void LoadImageByFile(string path, Action<Texture2D> callback){LoadTexture2DByFile(path, callback);}public void LoadImages(string[] paths, Action<List<Texture2D>> callback){Debug.Log("start!!!!!");List<Texture2D> list = new List<Texture2D>();for (int i = 0; i < paths.Length; i++){LoadImage(paths[i], tex => list.Add(tex));}callback?.Invoke(list);Debug.Log("end!!!!!" + list.Count);}public void LoadImagesByFile(string[] paths, Action<List<Texture2D>> callback){List<Texture2D> list = new List<Texture2D>();for (int i = 0; i < paths.Length; i++){var data = File.ReadAllBytes(paths[i]);Texture2D tex = new Texture2D(1, 1);if (tex.LoadImage(data))list.Add(tex);}callback?.Invoke(list);}public void DownloadImageAndSave(string url, string savedFolder, string fileName, Action callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savedFolder + "/" + fileName, Texture2DToByte(url, tex));callback?.Invoke();}));}public void DownloadImageAndSave(string url, string savePath, Action callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke();}));}public void DownloadImageAndSave_Texture2D(string url, string savedFolder, string fileName, Action<Texture2D> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savedFolder + "/" + fileName, Texture2DToByte(url, tex));callback?.Invoke(tex);}));}public void DownloadImageAndSave_Texture2D(string url, string savePath, Action<Texture2D> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke(tex);}));}public void DownloadImageAndSave_FilePath(string url, string savedFolder, string fileName, Action<string> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, Texture2DToByte(url, tex));callback?.Invoke(path);}));}public void DownloadImageAndSave_FilePath(string url, string savePath, Action<string> callback = null){helper.StartCoroutine(LoadTexture2D(url, tex =>{File.WriteAllBytes(savePath, Texture2DToByte(url, tex));callback?.Invoke(savePath);}));}public void DownloadImagesAndSave(string[] urls, string savedFolder, string[] fileNames, Action completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadImageAndSave(urls[i], savedFolder, fileNames[i], () =>{++completedNum;if (completedNum == urls.Length){completedCallback?.Invoke();Debug.Log("所以文件下载完成!");}});}}public void DownloadImagesAndSave_Texture2DPaths(string[] urls, string savedFolder, string[] fileNames, Action<string[]> callback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;string[] filePaths = new string[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_FilePath(urls[i], savedFolder, fileNames[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == urls.Length){callback?.Invoke(filePaths);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2DPaths(string[] urls, string[] savePaths, Action<string[]> callback = null){if (urls.Length != savePaths.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;string[] filePaths = new string[savePaths.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_FilePath(urls[i], savePaths[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == urls.Length){callback?.Invoke(filePaths);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2Ds(string[] urls, string savedFolder, string[] fileNames, Action<Texture2D[]> callback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;Texture2D[] textures = new Texture2D[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_Texture2D(urls[i], savedFolder, fileNames[i], tex =>{textures[completedNum] = tex;++completedNum;if (completedNum == urls.Length){callback?.Invoke(textures);Debug.Log("所以图片下载完成!");}});}}public void DownloadImagesAndSave_Texture2Ds(string[] urls, string[] savePaths, Action<Texture2D[]> callback = null){if (urls.Length != savePaths.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;Texture2D[] textures = new Texture2D[savePaths.Length];for (int i = 0; i < urls.Length; i++){DownloadImageAndSave_Texture2D(urls[i], savePaths[i], tex =>{textures[completedNum] = tex;++completedNum;if (completedNum == urls.Length){callback?.Invoke(textures);Debug.Log("所以图片下载完成!");}});}}#endregion#region download filepublic void DownloadFileAndSave(string url, string savedFolder, string fileName, Action callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savedFolder + "/" + fileName, data);callback?.Invoke();}));}public void DownloadFileAndSave(string url, string savePath, Action callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke();}));}public void DownloadFileAndSave_FilePath(string url, string savedFolder, string fileName, Action<string> callback = null){helper.StartCoroutine(LoadByte(url, data =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, data);callback?.Invoke(path);}));}public void DownloadFileAndSave_FilePath(string url, string savePath, Action<string> callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke(savePath);}));}public void DownloadFileAndSave_FileData(string url, string savedFolder, string fileName, Action<byte[]> callback = null){helper.StartCoroutine(LoadByte(url, data =>{string path = savedFolder + "/" + fileName;File.WriteAllBytes(path, data);callback?.Invoke(data);}));}public void DownloadFileAndSave_FileData(string url, string savePath, Action<byte[]> callback = null){helper.StartCoroutine(LoadByte(url, data =>{File.WriteAllBytes(savePath, data);callback?.Invoke(data);}));}public void DownloadFilesAndSave(string[] urls, string savedFolder, string[] fileNames, Action completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadFileAndSave(urls[i], savedFolder, fileNames[i], () =>{++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke();}});}}public void DownloadFilesAndSave(string[] urls, string[] savePath, Action callback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;for (int i = 0; i < urls.Length; i++){DownloadFileAndSave(urls[i], savePath[i], () =>{++completedNum;if (completedNum == savePath.Length){callback?.Invoke();}});}}public void DownloadFilesAndSave_FilePaths(string[] urls, string savedFolder, string[] fileNames, Action<string[]> completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;string[] filePaths = new string[fileNames.Length];for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FilePath(urls[i], savedFolder, fileNames[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke(filePaths);}});}}public void DownloadFilesAndSave_FilePaths(string[] urls, string[] savePath, Action<string[]> completedCallback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;string[] filePaths = new string[savePath.Length];for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FilePath(urls[i], savePath[i], path =>{filePaths[completedNum] = path;++completedNum;if (completedNum == savePath.Length){completedCallback?.Invoke(filePaths);}});}}public void DownloadFilesAndSave_FileDatas(string[] urls, string savedFolder, string[] fileNames, Action<List<byte[]>> completedCallback = null, bool deleteFolder = false, bool recursive = false){if (urls.Length != fileNames.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}DeleteFolder(savedFolder, deleteFolder, recursive);int completedNum = 0;List<byte[]> allDatas = new List<byte[]>(fileNames.Length);for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FileData(urls[i], savedFolder, fileNames[i], data =>{allDatas.Add(data);++completedNum;if (completedNum == fileNames.Length){completedCallback?.Invoke(allDatas);}});}}public void DownloadFilesAndSave_FileDatas(string[] urls, string[] savePath, Action<List<byte[]>> completedCallback = null){if (urls.Length != savePath.Length){Debug.Log("下载数量和保存的文件数量不一致!");return;}int completedNum = 0;List<byte[]> allDatas = new List<byte[]>(savePath.Length);for (int i = 0; i < urls.Length; i++){DownloadFileAndSave_FileData(urls[i], savePath[i], data =>{allDatas.Add(data);++completedNum;if (completedNum == savePath.Length){completedCallback?.Invoke(allDatas);}});}}#endregion#region download audiopublic void DownloadAudioAndSave_FileData(string url, string savedFolder, string fileName, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, savedFolder, fileName, callback));}public void DownloadAudioAndSave_FileData(string url, string savePath, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, savePath, callback));}public void LoadAudioClip(string url, Action<AudioClip> callback = null){helper.StartCoroutine(LoadAudio(url, callback));}#endregion}
}

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

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

相关文章

如何使用 ArcGIS Pro 制作三维建筑

三维地图已经逐渐成为未来地图的趋势&#xff0c;对于大范围应用&#xff0c;只需要普通的建筑体块就行&#xff0c;如果有高程数据&#xff0c;还可以结合地形进行显示&#xff0c;这里为大家介绍一下 ArcGIS Pro 制作三维建筑的方法&#xff0c;希望能对你有所帮助。 数据来…

单片机之串口通信

目录 串口介绍 通信的基本概念 并行通信和串行通信 同步通信和异步通信 串行异步通信方式 串行同步通信方式 通信协议 单片机常见通信接口 串行通信三种模式 串口参数 传输速度 ​串口的连接 电平标准 串行口的组成 串口数据缓冲寄存器 串行口控制寄存器 串口…

HackTheBox-Machines--Legacy

文章目录 1 端口扫描2 测试思路3 445端口漏洞测试4 flag Legacy 测试过程 1 端口扫描 nmap -sC -sV 10.129.227.1812 测试思路 目标开启了135、139、445端口&#xff0c;445 SMB服务存在很多可利用漏洞&#xff0c;所以测试点先从445端口开始。而且在Nmap扫描结果中&#xff0c…

深入Facebook的世界:探索数字化社交的无限可能性

引言 随着数字化时代的到来&#xff0c;社交媒体平台已经成为了人们日常生活中不可或缺的一部分&#xff0c;而其中最为突出的代表之一便是Facebook。作为全球最大的社交媒体平台之一&#xff0c;Facebook不仅仅是一个社交网络&#xff0c;更是一个数字化社交的生态系统&#…

蓝桥杯 2022 省A 选数异或

一种比较无脑暴力点的方法&#xff0c;时间复杂度是(nm)。 (注意的优先级比^高&#xff0c;记得加括号(a[i]^a[j])x&#xff09; #include <iostream> #include <vector> #include <bits/stdc.h> // 包含一些 C 标准库中未包含的特定实现的函数的头文件 usi…

Gemma开源AI指南

近几个月来&#xff0c;谷歌推出了 Gemini 模型&#xff0c;在人工智能领域掀起了波澜。 现在&#xff0c;谷歌推出了 Gemma&#xff0c;再次引领创新潮流&#xff0c;这是向开源人工智能世界的一次变革性飞跃。 与前代产品不同&#xff0c;Gemma 是一款轻量级、小型模型&…

2024/3/27打卡更小的数(十四届蓝桥杯)——区间DP

目录 题目 思路 代码 题目 思路 题目说求数组某个区间中的数进行翻转&#xff0c;由于区间选择多&#xff0c;首先想到DP问题。 第一版想到的方法&#xff08;错误的&#xff09;&#xff0c;当进行状态计算的时候&#xff0c;无法判定区间是否翻转后满足要求&#xff0c;…

day72Html

常用标签&#xff1a; 分类&#xff1a; 块级标签&#xff1a;独立成行 行级标签&#xff1a;不独立成行&#xff0c;同一行可放多个行级标 注意网页显示时&#xff0c;忽略空白字符,(回车符&#xff0c;空格&#xff0c;tab制表符&#xff09; 一&#xff09;块级标签&#xf…

算法之美:B+树原理、应用及Mysql索引底层原理剖析

B树的一种变种形式&#xff0c;B树上的叶子结点存储关键字以及相应记录的地址&#xff0c;同等存储空间下比B-Tree存储更多Key。非叶子节点不对关键字记录的指针进行保存&#xff0c;只进行数据索引 , 树的层级会更少 , 所有叶子节点都在同一层, 叶子节点的关键字从小到大有序排…

IntelliJ IDEA中遇到的“cannot access java.lang.String“错误及其解决方案(day8)

intelliJ 今天遇到使用intelliJ遇到了一个新错误&#xff0c;有问题就解决问题是一个程序员最基本的修养&#xff0c;如下&#xff1a; 在上面的代码中&#xff0c;我使用了this.这个关键字&#xff0c;发现出现了以上问题&#xff0c;找了一些资料&#xff0c;不是很明白&am…

基于CNN-RNN的动态手势识别系统实现与解析

一、环境配置 为了成功实现基于CNN-RNN的动态手势识别系统&#xff0c;你需要确保你的开发环境已经安装了以下必要的库和工具&#xff1a; Python&#xff1a;推荐使用Python 3.x版本&#xff0c;作为主要的编程语言。TensorFlow&#xff1a;深度学习框架&#xff0c;用于构建…

LLM2LLM: Boosting LLMs with Novel Iterative Data Enhancement

LLM2LLM: Boosting LLMs with Novel Iterative Data Enhancement 相关链接&#xff1a;arXiv GitHub 关键字&#xff1a;LLM、Data Augmentation、Fine-tuning、NLP、Low-data Regime 摘要 预训练的大型语言模型&#xff08;LLMs&#xff09;目前是解决绝大多数自然语言处理任…

《Vision mamba》论文笔记

原文出处&#xff1a; [2401.09417] Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Model (arxiv.org) 原文笔记&#xff1a; What&#xff1a; Vision Mamba: Efficient Visual Representation Learning with Bidirectional St…

分类模型评估:混淆矩阵与ROC曲线

1.混淆矩阵2.ROC曲线 & AUC指标 理解混淆矩阵和ROC曲线之前&#xff0c;先区分几个概念。对于分类问题&#xff0c;不论是多分类还是二分类&#xff0c;对于某个关注类来说&#xff0c;都可以看成是二分类问题&#xff0c;当前的这个关注类为正类&#xff0c;所有其他非关注…

Java项目:78 springboot学生宿舍管理系统的设计与开发

作者主页&#xff1a;源码空间codegym 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文中获取源码 项目介绍 系统的角色&#xff1a;管理员、宿管、学生 管理员管理宿管员&#xff0c;管理学生&#xff0c;修改密码&#xff0c;维护个人信息。 宿管员…

RegSeg 学习笔记(待完善)

论文阅读 解决的问题 引用别的论文的内容 可以用 controlf 寻找想要的内容 PPM 空间金字塔池化改进 SPP / SPPF / SimSPPF / ASPP / RFB / SPPCSPC / SPPFCSPC / SPPELAN &#xfffc; ASPP STDC&#xff1a;short-term dense concatenate module 和 DDRNet SE-ResNeXt …

Java代码混淆技术在应用程序保护中的关键作用与应用

摘要 本文探讨了代码混淆在保护Java代码安全性和知识产权方面的重要意义。通过混淆技术&#xff0c;可以有效防止代码被反编译、逆向工程或恶意篡改&#xff0c;提高代码的安全性。常见的Java代码混淆工具如IPAGuard、Allatori、DashO、Zelix KlassMaster和yGuard等&#xff0…

2. Java基本语法

文章目录 2. Java基本语法2.1 关键字保留字2.1.1 关键字2.1.2 保留字2.1.3 标识符2.1.4 Java中的名称命名规范 2.2 变量2.2.1 分类2.2.2 整型变量2.2.3 浮点型2.2.4 字符型 char2.2.5 Unicode编码2.2.6 UTF-82.2.7 boolean类型 2.3 基本数据类型转换2.3.1 自动类型转换2.2.2 强…

JVM篇详细分析

JVM总体图 程序计数器&#xff1a; 线程私有的&#xff0c;每个线程一份&#xff0c;内部保存字节码的行号&#xff0c;用于记录正在执行字节码指令的地址。&#xff08;可通过javap -v XX.class命令查看&#xff09; java堆&#xff1a; 线程共享的区域&#xff0c;用来保存对…

Java安全篇-Fastjson漏洞

前言知识&#xff1a; 一、json 概念&#xff1a; json全称是JavaScript object notation。即JavaScript对象标记法&#xff0c;使用键值对进行信息的存储。 格式&#xff1a; {"name":"wenda","age":21,} 作用&#xff1a; JSON 可以作为…