知乎首页 粒子效果 动态背景
2017-01-16 16:28
295 查看
效果展示:
知乎网址:https://www.zhihu.com/
View Code
代码如上:
如果有需要 可以把粒子的js配置代码放到单独文件种去
知乎网址:https://www.zhihu.com/
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style> body { background: #f7fafc none repeat scroll 0 0; color: #555; font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",Arial,sans-serif; font-size: 15px; line-height: 1.7; } #particles { position: absolute; top: 0; width: 100%; z-index: -1; } </style> </head> <body> <div id="particles"></div> <script src="Content/js/indexS/particles.js"></script> <script type="text/javascript"> particlesJS("particles", { "particles": { "number": { "value": 20, "density": { "enable": true, "value_area": 1E3 } }, "color": { "value": "#e1e1e1" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 15, "random": true, "anim": { "enable": false, "speed": 180, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 650, "color": "#cfcfcf", "opacity": 0.26, "width": 1 }, "move": { "enable": true, "speed": 2, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": false, "mode": "repulse" }, "onclick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 200, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true } ); </script> </body> </html>
View Code
代码如上:
如果有需要 可以把粒子的js配置代码放到单独文件种去
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ particlesJS.load('particles-js', 'assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
相关文章推荐
- 基于Particles.js制作超炫粒子动态背景效果(仿知乎)
- 使用particles.js实现知乎首页Canvas粒子效果,多边形,圆形粒子
- h5 canvas 仿知乎动态粒子背景
- 弄个知乎的粒子动态背景_实践particles.js
- html5canvas:教你实现知乎登录动态粒子背景
- html5canvas:教你实现知乎登录动态粒子背景
- [ay原创作品]用wpf写了个模仿36Kr网站登录背景的效果-【鄙视博客园,已被移出首页,代码在我自己官网上,自己下载学习吧】
- iOS实现登录页背景具有动态效果
- jQuery实现响应鼠标背景变化的动态菜单效果代码
- 制作桌面精灵(动态桌面)——鼠标跟随的粒子效果
- 网页 div(背景)随鼠标成动态效果
- jQuery动态背景图片效果实现方法
- 动态背景-粒子模型
- 动态设置Button、ImageView等组件在不同状态下的背景/前景显示效果。 扩展下的话可以前景/背景的显示效果可以使用网络图片。
- 论坛源码推荐(3月3日):多样式图表组件 动态背景模糊的侧边栏菜单效果
- Android动态封装圆角,按下效果的背景
- 【jQuery小实例】---3 凤凰网首页图片动态效果
- js新浪首页可关闭背景效果代码
- 仿乐安全首页动态效果