canvas实现鼠标可交互的粒子黑洞动画效果代码
代码语言:html
所属分类:粒子
代码描述:canvas实现鼠标可交互的粒子黑洞动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body, html { height: 100%; margin: 0; padding: 0; } body { height: 100%; background-color: rgba(25,25,25,1); overflow: hidden; } #blackhole { height: 100%; width: 100%; position: relative; display: flex; } .centerHover { width: 255px; height: 255px; background-color: transparent; border-radius: 50%; position: absolute; left: 50%; top: 50%; margin-top: -128px; margin-left: -128px; z-index: 2; cursor: pointer; line-height: 255px; text-align: center; transition: all 500ms; } .centerHover.open { opacity: 0; pointer-events: none; } .centerHover:hover span { color: #DDD; } .centerHover:hover span:before { background-color: #DDD; } .centerHover:hover span:after { background-color: #DDD; } .centerHover span { color: #666; font-family: serif; font-size: 18px; position: relative; transition: all 500ms; } .centerHover span:before { content: ''; display: inline-block; height: 1px; width: 16px; margin-right: 12px; margin-bottom: 4px; background-color: #666; transition: all 500ms; } .centerHover span:after { content: ''; display: inline-block; height: 1px; width: 16px; margin-left: 12px; margin-bottom: 4px; background-color: #666; transition: all 500ms; } canvas { position: relative; z-index: 1; width: 100%; height: 100%; margin: auto; } #blackhole { height: 100%; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0