集成evanyou背景动画效果

This commit is contained in:
WangHao
2020-10-03 23:37:31 +08:00
parent 69b7e0a806
commit 763638c7ec
4 changed files with 82 additions and 5 deletions

View File

@ -8,6 +8,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.10.0/jquery.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<style> <style>
html, html,
body, body,

View File

@ -195,7 +195,6 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -292,6 +291,7 @@
} }
}, },
mounted() { mounted() {
// document.querySelector("#datalist").addEventListener('scroll', this.handleScroll) // document.querySelector("#datalist").addEventListener('scroll', this.handleScroll)
}, },
computed:{ computed:{
@ -564,9 +564,9 @@
windowurl(url, bookmarkId) { windowurl(url, bookmarkId) {
// window.open(url+this.urltext); // window.open(url+this.urltext);
window.open(url); window.open(url);
}, },
}, },
@ -657,7 +657,7 @@
position: absolute; position: absolute;
background-color: #acd7ff; background-color: #acd7ff;
right: 0; right: 0;
display: none;
} }
.editlist { .editlist {
@ -666,6 +666,7 @@
height: 70px; height: 70px;
flex-flow: wrap; flex-flow: wrap;
align-items: center; align-items: center;
} }
.editlist div { .editlist div {
@ -767,6 +768,8 @@
.info-wrap{ .info-wrap{
color: #9EABB3; color: #9EABB3;
} }
/**evanyou背景特效**/
</style> </style>

View File

@ -10,16 +10,25 @@
<div class="mid"> <div class="mid">
<!--右侧div内容--> <!--右侧div内容-->
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'Dashboard', name: 'Dashboard',
mounted () { mounted () {
this.dragControllerDiv(); this.dragControllerDiv();
}, },
methods: { methods: {
dragControllerDiv: function () { dragControllerDiv: function () {
var resize = document.getElementsByClassName('resize'); var resize = document.getElementsByClassName('resize');
var left = document.getElementsByClassName('left'); var left = document.getElementsByClassName('left');
@ -116,4 +125,6 @@
box-shadow: -1px 4px 5px 3px rgba(0, 0, 0, 0.11); box-shadow: -1px 4px 5px 3px rgba(0, 0, 0, 0.11);
} }
</style> </style>

View File

@ -279,7 +279,8 @@
<el-button @click="bookmarkcancel"> </el-button> <el-button @click="bookmarkcancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--背景特效-->
<canvas id="evanyou"></canvas>
</div> </div>
@ -423,6 +424,9 @@
}, },
//div拖动 //div拖动
this.dragControllerDivs(); this.dragControllerDivs();
/**ebabyou 背景特效**/
// this.evanyoucss();
}, },
created() { created() {
var that = this; var that = this;
@ -435,6 +439,52 @@
}, },
methods: { methods: {
/**evanyou 背景特效**/
evanyoucss:function(){
var c = document.getElementById('evanyou'),
x = c.getContext('2d'),
pr = window.devicePixelRatio || 1,
w = window.innerWidth,
h = window.innerHeight,
f = 90,
q,
m = Math,
r = 0,
u = m.PI * 2,
v = m.cos,
z = m.random;
c.width = w * pr;
c.height = h * pr;
x.scale(pr, pr);
x.globalAlpha = 0.6;
function evanyou() {
x.clearRect(0, 0, w, h)
q = [{ x: 0, y: h * .7 + f }, { x: 0, y: h * .7 - f }]
while (q[1].x < w + f) d(q[0], q[1])
}
function d(i, j) {
x.beginPath()
x.moveTo(i.x, i.y)
x.lineTo(j.x, j.y)
var k = j.x + (z() * 2 - 0.25) * f,
n = y(j.y)
x.lineTo(k, n)
x.closePath()
r -= u / -50
x.fillStyle = '#' + (v(r) * 127 + 128 << 16 | v(r + u / 3) * 127 + 128 << 8 | v(r + u / 3 * 2) * 127 + 128).toString(16)
x.fill()
q[0] = q[1]
q[1] = { x: k, y: n }
}
function y(p) {
var t = p + (z() * 2 - 1.1) * f
return (t > h || t < 0) ? y(p) : t
}
document.onclick = evanyou
document.ontouchstart = evanyou
evanyou();
},
/**div拖拽宽度**/ /**div拖拽宽度**/
dragControllerDivs: function () { dragControllerDivs: function () {
console.log("开始拖拽") console.log("开始拖拽")
@ -1570,6 +1620,18 @@
user-select:none; /* CSS3属性 */ user-select:none; /* CSS3属性 */
} }
#evanyou{
position:fixed;
width:100%;
height:100%;
left:0;
top:0;
z-index: -1;
}
</style> </style>