canvas鼠标跟随彩色泡泡粒子效果代码
代码语言:html
所属分类:粒子
代码描述:canvas鼠标跟随彩色泡泡粒子效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body{ background-color: #222438; margin: 0; font-family: Poppins; } main{ width: 100vw; height: 100vh; overflow: hidden; background-image: repeating-linear-gradient( to right, transparent 0 50px, #fff1 50px 51px ), repeating-linear-gradient( to bottom, transparent 0 50px, #fff1 50px 51px ); position: relative; } form{ background-color: #eee; width: max-content; padding: 5px; margin: 10px; border-radius: 24px; display: flex; gap: 10px; cursor: pointer; } form input, button{ width: 30px; height: 30px; padding: 0; border: none; background-color: transparent; font-size: large; cursor: pointer; } form input::-webkit-color-swatch-wrapper{ padding: 0; cursor: pointer; } form input::-webkit-color-swatch{ border-radius: 50%; cursor: pointer; } #list textarea{ all: unset; color: #d6d6d6; } #list .note{ background-color: #333; width: max-content; border-top: 30px solid #e6b905; border-radius: 10px; box-shadow: 0 20px 50px #0004; padding: 10px; position: absolute; cursor: pointer; top: 60px; left: 50px; } #list .note span{ position: absolute; bottom: 100%; right: 0; height: 30px; font-family: cursive; font-size: large; padding-right: 10px; cursor: pointer; } </style> </head> <body translate="no"> <main> <canvas></canvas> <form action=""> <input type="color" id="color" value="#e6b905"> <button type="button" id="createBtn">+</button> </form> <div id="list"></div> </main> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script > let color = document.getElementById('color'); let createBtn = document.getElementById('createBtn'); let list = document.getElementById('list'); createBtn.onclick = () => { let newNote = document.createElement('div'); newNote.classList.add('note'); newNote.innerHTML = ` <span class="close">x</span> <textarea placeholder="Write Content..." rows="10" cols="30"></textarea>`; newNote.style.borderColor = color.value; list.appendChild(newNote); }; document.addEventListener('click', event => { if (event.target.classList.contains('close')) { event.target.parentNode.remove(); } }); let cursor = { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0