中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

深圳設(shè)計(jì)網(wǎng)站今日足球賽事推薦

深圳設(shè)計(jì)網(wǎng)站,今日足球賽事推薦,江蘇網(wǎng)站備案流程圖,網(wǎng)站制作建設(shè)公司哪家好先看效果,代碼寫(xiě)的比較亂,有待優(yōu)化 效果 https://linyisonger.github.io/H5.Examples/?name./089.%E7%9C%8B%E6%98%9F%E6%98%9F%E7%9A%84%E8%88%9E%E8%80%85.html 思路 看起來(lái)很簡(jiǎn)單,實(shí)則也不是很難,就是需要思路要打開(kāi)。 一…

先看效果,代碼寫(xiě)的比較亂,有待優(yōu)化

效果

https://linyisonger.github.io/H5.Examples/?name=./089.%E7%9C%8B%E6%98%9F%E6%98%9F%E7%9A%84%E8%88%9E%E8%80%85.html
在這里插入圖片描述

思路

看起來(lái)很簡(jiǎn)單,實(shí)則也不是很難,就是需要思路要打開(kāi)。
一開(kāi)始的流程思路是

思路一

  1. 通過(guò)視頻獲取骨骼節(jié)點(diǎn)動(dòng)畫(huà) ?
  2. 使用AI文生圖+骨骼節(jié)點(diǎn)生成人物信息 ? 效果不達(dá)預(yù)期
  3. 確定人物頭部位置+序列幀動(dòng)畫(huà)

思路二

  1. 通過(guò)視頻獲取骨骼節(jié)點(diǎn)動(dòng)畫(huà) ?
  2. 通過(guò)骨骼動(dòng)畫(huà)進(jìn)行canvas渲染,節(jié)點(diǎn)連接從而打到火柴人的效果。?
  3. 確定人物頭部位置+序列幀動(dòng)畫(huà) ? 畫(huà)布太大無(wú)法渲染一張圖
  4. 確定人物頭部位置+序列幀動(dòng)畫(huà) + JSON存儲(chǔ) ?

實(shí)現(xiàn)

  1. 通過(guò)視頻播放+requestAnimationFrame獲取每幀圖片
  2. 通過(guò)@tensorflow/tfjs+@tensorflow-models/posenet來(lái)獲取圖片骨骼節(jié)點(diǎn)
  3. 通過(guò)canvas進(jìn)行骨骼連接

這又是一篇新的內(nèi)容,AI方面不是很了解,只是看著教程做的。
https://linyisonger.github.io/H5.Examples/?name=./090.%E7%81%AB%E6%9F%B4%E4%BA%BA%E7%94%9F%E6%88%90%E5%99%A8.html
在這里插入圖片描述
上傳視頻后輸出的JSON文件是這個(gè)示例所需要的。

里面包含每一幀的火柴人Base64圖片,頭像應(yīng)該放置的位置。

代碼

獲取GitHub倉(cāng)庫(kù)點(diǎn)星星的用戶(hù)列表

? 當(dāng)然這不是很好的寫(xiě)法,一旦出現(xiàn)報(bào)錯(cuò)就是死循環(huán)

/*** 獲取star的用戶(hù) 默認(rèn)30一頁(yè)* @author 	 linyisonger* @date 	 2025-02-18*/
async function getStargazers(page = 1) {const result = await fetch(`https://api.github.com/repos/linyisonger/H5.Examples/stargazers?page=${page}`)return await result.json()
}/*** 獲取所有star的用戶(hù)* @author 	 linyisonger* @date 	 2025-02-18*/
async function getAllStargazers(page = 1, users = []) {let stargazers = await getStargazers(page)users = users.concat(stargazers)if (stargazers.length < 30) return usersreturn await getAllStargazers(page + 1, users)
}

其他的感覺(jué)沒(méi)什么重點(diǎn)

完整代碼

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="./assets/global.css"><style>#container {display: flex;justify-content: center;align-items: center;flex-wrap: wrap;height: 100vh;align-content: center;position: relative;}#container canvas {margin-top: -140px}.welcome-statement {position: absolute;top: 100px;font-size: 40px;color: #999;}.join-us {position: absolute;bottom: 200px;z-index: 100;display: inline-flex;padding: 0 20px 3px;line-height: 40px;background: linear-gradient(to bottom, rgb(87, 196, 245), rgb(26, 147, 206));color: rgb(254, 252, 255);cursor: pointer;border-radius: 4px;font-weight: bold;box-shadow: inset 0px -3px 0 rgb(19, 98, 139);}.join-us:active {opacity: .7;box-shadow: inset 0px 0px 0 transparent;}.bgm-controller {position: absolute;right: 20px;top: 20px;width: 40px;}.bgm-controller:active {opacity: .7;}</style>
</head><body><div id="container"><!-- <audio class="bgm" muted="true"><source src="./assets/dance/swing-dance.mp3" /></audio> --><video class="bgm" muted style="display: none;"><source src="./assets/dance/kemusan.mp4" /></video><div class="welcome-statement">感謝各位給 H5.Examples 點(diǎn)??~</div><a class="join-us" href="https://github.com/linyisonger/H5.Examples">加入我們</a><img class="bgm-controller" src="./assets/dance/bgm-c.png"></div><script type="module">/*** 加載圖* @param {string} src* @returns {Promise<HTMLImageElement>}*/function loadImage(src) {return new Promise((resolve) => {let image = new Image()image.src = src;image.onload = (ev) => {resolve(image)}})}/*** 加載音樂(lè)* @param {string} src* @returns {Promise<HTMLImageElement>}*/function loadAudio(src) {return new Promise((resolve) => {let audio = new Audio(src)audio.addEventListener("loadeddata", resolve)})}/*** 獲取star的用戶(hù) 默認(rèn)30一頁(yè)* @author 	 linyisonger* @date 	 2025-02-18*/async function getStargazers(page = 1) {const result = await fetch(`https://api.github.com/repos/linyisonger/H5.Examples/stargazers?page=${page}`)return await result.json()}/*** 獲取所有star的用戶(hù)* @author 	 linyisonger* @date 	 2025-02-18*/async function getAllStargazers(page = 1, users = []) {let stargazers = await getStargazers(page)users = users.concat(stargazers)if (stargazers.length < 30) return usersreturn await getAllStargazers(page + 1, users)}// getAllStargazers().then((res) => {//     console.log("獲取star的用戶(hù)", res);// })let dancers = [{"login": "AnChangSu","id": 5037050,"node_id": "MDQ6VXNlcjUwMzcwNTA=","avatar_url": "https://avatars.githubusercontent.com/u/5037050?v=4","gravatar_id": "","url": "https://api.github.com/users/AnChangSu","html_url": "https://github.com/AnChangSu","followers_url": "https://api.github.com/users/AnChangSu/followers","following_url": "https://api.github.com/users/AnChangSu/following{/other_user}","gists_url": "https://api.github.com/users/AnChangSu/gists{/gist_id}","starred_url": "https://api.github.com/users/AnChangSu/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/AnChangSu/subscriptions","organizations_url": "https://api.github.com/users/AnChangSu/orgs","repos_url": "https://api.github.com/users/AnChangSu/repos","events_url": "https://api.github.com/users/AnChangSu/events{/privacy}","received_events_url": "https://api.github.com/users/AnChangSu/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "HGinGitHub","id": 103415496,"node_id": "U_kgDOBin-yA","avatar_url": "https://avatars.githubusercontent.com/u/103415496?v=4","gravatar_id": "","url": "https://api.github.com/users/HGinGitHub","html_url": "https://github.com/HGinGitHub","followers_url": "https://api.github.com/users/HGinGitHub/followers","following_url": "https://api.github.com/users/HGinGitHub/following{/other_user}","gists_url": "https://api.github.com/users/HGinGitHub/gists{/gist_id}","starred_url": "https://api.github.com/users/HGinGitHub/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/HGinGitHub/subscriptions","organizations_url": "https://api.github.com/users/HGinGitHub/orgs","repos_url": "https://api.github.com/users/HGinGitHub/repos","events_url": "https://api.github.com/users/HGinGitHub/events{/privacy}","received_events_url": "https://api.github.com/users/HGinGitHub/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "harris2012","id": 12846977,"node_id": "MDQ6VXNlcjEyODQ2OTc3","avatar_url": "https://avatars.githubusercontent.com/u/12846977?v=4","gravatar_id": "","url": "https://api.github.com/users/harris2012","html_url": "https://github.com/harris2012","followers_url": "https://api.github.com/users/harris2012/followers","following_url": "https://api.github.com/users/harris2012/following{/other_user}","gists_url": "https://api.github.com/users/harris2012/gists{/gist_id}","starred_url": "https://api.github.com/users/harris2012/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/harris2012/subscriptions","organizations_url": "https://api.github.com/users/harris2012/orgs","repos_url": "https://api.github.com/users/harris2012/repos","events_url": "https://api.github.com/users/harris2012/events{/privacy}","received_events_url": "https://api.github.com/users/harris2012/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "Lavenir7","id": 105573717,"node_id": "U_kgDOBkrtVQ","avatar_url": "https://avatars.githubusercontent.com/u/105573717?v=4","gravatar_id": "","url": "https://api.github.com/users/Lavenir7","html_url": "https://github.com/Lavenir7","followers_url": "https://api.github.com/users/Lavenir7/followers","following_url": "https://api.github.com/users/Lavenir7/following{/other_user}","gists_url": "https://api.github.com/users/Lavenir7/gists{/gist_id}","starred_url": "https://api.github.com/users/Lavenir7/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/Lavenir7/subscriptions","organizations_url": "https://api.github.com/users/Lavenir7/orgs","repos_url": "https://api.github.com/users/Lavenir7/repos","events_url": "https://api.github.com/users/Lavenir7/events{/privacy}","received_events_url": "https://api.github.com/users/Lavenir7/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "linyisonger","id": 34770610,"node_id": "MDQ6VXNlcjM0NzcwNjEw","avatar_url": "https://avatars.githubusercontent.com/u/34770610?v=4","gravatar_id": "","url": "https://api.github.com/users/linyisonger","html_url": "https://github.com/linyisonger","followers_url": "https://api.github.com/users/linyisonger/followers","following_url": "https://api.github.com/users/linyisonger/following{/other_user}","gists_url": "https://api.github.com/users/linyisonger/gists{/gist_id}","starred_url": "https://api.github.com/users/linyisonger/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/linyisonger/subscriptions","organizations_url": "https://api.github.com/users/linyisonger/orgs","repos_url": "https://api.github.com/users/linyisonger/repos","events_url": "https://api.github.com/users/linyisonger/events{/privacy}","received_events_url": "https://api.github.com/users/linyisonger/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "lpleipeng","id": 39250004,"node_id": "MDQ6VXNlcjM5MjUwMDA0","avatar_url": "https://avatars.githubusercontent.com/u/39250004?v=4","gravatar_id": "","url": "https://api.github.com/users/lpleipeng","html_url": "https://github.com/lpleipeng","followers_url": "https://api.github.com/users/lpleipeng/followers","following_url": "https://api.github.com/users/lpleipeng/following{/other_user}","gists_url": "https://api.github.com/users/lpleipeng/gists{/gist_id}","starred_url": "https://api.github.com/users/lpleipeng/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/lpleipeng/subscriptions","organizations_url": "https://api.github.com/users/lpleipeng/orgs","repos_url": "https://api.github.com/users/lpleipeng/repos","events_url": "https://api.github.com/users/lpleipeng/events{/privacy}","received_events_url": "https://api.github.com/users/lpleipeng/received_events","type": "User","user_view_type": "public","site_admin": false},{"login": "xxxggg-ctrl","id": 63829555,"node_id": "MDQ6VXNlcjYzODI5NTU1","avatar_url": "https://avatars.githubusercontent.com/u/63829555?v=4","gravatar_id": "","url": "https://api.github.com/users/xxxggg-ctrl","html_url": "https://github.com/xxxggg-ctrl","followers_url": "https://api.github.com/users/xxxggg-ctrl/followers","following_url": "https://api.github.com/users/xxxggg-ctrl/following{/other_user}","gists_url": "https://api.github.com/users/xxxggg-ctrl/gists{/gist_id}","starred_url": "https://api.github.com/users/xxxggg-ctrl/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/xxxggg-ctrl/subscriptions","organizations_url": "https://api.github.com/users/xxxggg-ctrl/orgs","repos_url": "https://api.github.com/users/xxxggg-ctrl/repos","events_url": "https://api.github.com/users/xxxggg-ctrl/events{/privacy}","received_events_url": "https://api.github.com/users/xxxggg-ctrl/received_events","type": "User","user_view_type": "public","site_admin": false}]let bgmControllerDom = document.querySelector('.bgm-controller')bgmControllerDom.addEventListener("click", () => {const bgm = document.body.querySelector('.bgm')bgm.muted = !bgm.muted;bgmControllerDom.setAttribute('src', bgm.muted ? './assets/dance/bgm-c.png' : './assets/dance/bgm-o.png')})// 2D火柴人 貼圖function fetchLoad(url) {return new Promise((resolve) => {fetch(url).then((response) => response.json()).then(resolve)})}async function initGame() {dancers = await getAllStargazers()let dance = await fetchLoad("./assets/dance/kemusan.json")const DROP_FRAME = 5 // 抽幀const ZOOM_OUT = .5// 檢查動(dòng)作信息// for (let i = 0; i < dance.frames.length; i++) {//     console.log(i);//     const frame = dance.frames[i];//     const img = document.createElement('img')//     img.src = frame.url;//     document.body.appendChild(img)// }let danceCvsList = []for (let i = 0; i < dancers.length; i++) {const dancer = dancers[i];let danceCvs = await createCanvas(dancer)danceCvsList.push({dancer,cvs: danceCvs})}let i = 0async function animationFrame() {if (i % DROP_FRAME == 0) {for (let j = 0; j < danceCvsList.length; j++) {const { cvs, dancer } = danceCvsList[j];await drawFrame(cvs, dance.frames[(i / DROP_FRAME) % dance.frames.length], dancer.avatar_url)}}requestAnimationFrame(animationFrame)i++;}await animationFrame()document.body.querySelector('.bgm').play()document.body.querySelector('.bgm').loop = true;/*** 創(chuàng)建一個(gè)用戶(hù)* @author 	 linyisonger* @date 	 2025-02-23*/function createCanvas(dancer) {let avatarUrl = dancer.avatar_urllet cvs = document.createElement("canvas")cvs.setAttribute('width', dance.width)cvs.setAttribute('height', dance.height)cvs.width = dance.width * ZOOM_OUT;cvs.height = dance.height * ZOOM_OUT;document.body.querySelector("#container").appendChild(cvs)return cvs}/*** 渲染一幀* @author 	 linyisonger* @date 	 2025-02-23*/async function drawFrame(cvs, frame, avatar) {/** @type {CanvasRenderingContext2D } */let ctx = cvs.getContext('2d')let roleImg = await loadImage(frame.url)let avatarImg = await loadImage(avatar)ctx.clearRect(0, 0, cvs.width, cvs.height)ctx.drawImage(roleImg, 0, 0, cvs.width, cvs.height)let avatarWidth = 40 * ZOOM_OUTctx.drawImage(avatarImg, (frame.avatar.x * ZOOM_OUT - avatarWidth / 2), (frame.avatar.y * ZOOM_OUT - avatarWidth / 2), avatarWidth, avatarWidth)}}initGame()</script></body></html>

源碼倉(cāng)庫(kù)

更新的話(huà)文章可能不一定會(huì)更新,倉(cāng)庫(kù)會(huì)可能更新,有問(wèn)題可以提issue~

https://github.com/linyisonger/H5.Examples

http://m.risenshineclean.com/news/58852.html

相關(guān)文章:

  • 網(wǎng)站開(kāi)發(fā)外包知名品牌營(yíng)銷(xiāo)案例100例
  • 用vs2015做網(wǎng)站企業(yè)網(wǎng)站seo優(yōu)化外包
  • 網(wǎng)站建設(shè)與規(guī)劃東莞seo培訓(xùn)
  • 青島免費(fèi)建網(wǎng)站外貿(mào)google推廣
  • 淄博網(wǎng)站制作高端網(wǎng)絡(luò)登錄百度app
  • 溫州做網(wǎng)站建設(shè)公司百度sem
  • 在線(xiàn)商城網(wǎng)站開(kāi)發(fā)代碼windows優(yōu)化大師是病毒嗎
  • 建立網(wǎng)站平臺(tái)需要那些技術(shù)鎮(zhèn)江seo快速排名
  • 正能量網(wǎng)站ip網(wǎng)絡(luò)營(yíng)銷(xiāo)推廣有哪些方法
  • 網(wǎng)站設(shè)計(jì) 聯(lián)系怎樣進(jìn)行網(wǎng)絡(luò)推廣效果更好
  • 做網(wǎng)站需要網(wǎng)站負(fù)責(zé)人推動(dòng)防控措施持續(xù)優(yōu)化
  • 提卡的網(wǎng)站怎么做查網(wǎng)站權(quán)重
  • 123邢臺(tái)招聘信息網(wǎng)鄭州企業(yè)網(wǎng)站seo
  • 微信開(kāi)發(fā)網(wǎng)站建設(shè)天津網(wǎng)站優(yōu)化
  • 網(wǎng)站建設(shè)調(diào)查問(wèn)卷天津網(wǎng)絡(luò)廣告公司
  • 如何做php分頁(yè)網(wǎng)站seo查詢(xún)愛(ài)站
  • 織夢(mèng)做的網(wǎng)站后臺(tái)頁(yè)優(yōu)化軟件
  • 專(zhuān)做壞消息的網(wǎng)站南寧seo產(chǎn)品優(yōu)化服務(wù)
  • 網(wǎng)站建設(shè)學(xué)院廣州網(wǎng)站建設(shè)公司
  • 網(wǎng)站建設(shè)哪個(gè)公司的好進(jìn)入百度知道首頁(yè)
  • 怎么用 c文件做網(wǎng)站頁(yè)面關(guān)鍵詞優(yōu)化
  • 企業(yè)網(wǎng)站建設(shè)方案書(shū)范文浙江新手網(wǎng)絡(luò)推廣
  • 做頭像網(wǎng)站長(zhǎng)沙網(wǎng)紅打卡景點(diǎn)排行榜
  • 無(wú)錫制作網(wǎng)站公司賣(mài)友情鏈接的哪來(lái)那么多網(wǎng)站
  • wordpress做的網(wǎng)站嗎整站seo外包
  • 外貿(mào)專(zhuān)業(yè)網(wǎng)站的公司江西網(wǎng)絡(luò)推廣seo
  • 廣州知名網(wǎng)站建設(shè)后臺(tái)管理便捷淘寶店鋪如何推廣
  • 中山 網(wǎng)站制作重慶seo優(yōu)化
  • 邯鄲網(wǎng)站建設(shè)公司哪家好建站軟件可以不通過(guò)網(wǎng)絡(luò)建設(shè)嗎
  • 怎么樣分析一個(gè)網(wǎng)站百度搜索引擎seo