91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

紅包照片模糊效果

發布時間:2020-07-02 13:02:48 來源:網絡 閱讀:349 作者:素顏豬 欄目:開發技術

效果圖

紅包照片模糊效果

紅包照片模糊效果

紅包照片模糊效果

html結構(index.html)

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>紅包照片</title>

<link rel="stylesheet" href="blur.css">

<script src="jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>

<div id="blur-div">

<img id="blur-image" src="20170122161717.png" alt="">

<canvas id="blur-canvas"></canvas>


<a href="javascript:reset()" class="button" id="reset-button">reset</a>

<a href="javascript:show()" class="button" id="show-button">show</a>

</div>

<script src="blur.js" type="text/javascript" charset="utf-8" ></script>

</body>

</html>

css樣式(blur.css)

#blur-div{

width: 600px;

height: 450px;

margin: 0 auto;

position: relative;

}



#blur-image{

display: block;

width: 600px;

height: 450px;

margin: 0 auto;


filter:blur(20px);

-webkit-filter:blur(20px);

-moz-filter:blur(20px);

-ms-filter:blur(20px);

-o-filter:blur(20px);


position: absolute;

left: 0px;

top: 0px;

z-index: 0;

}



#blur-canvas{

display: block;

margin: 0 auto;

position: absolute;

left: 0px;

top: 0px;

z-index: 100;

}


.button{

display: block;

position: absolute;

z-index: 200;

width: 100px;

height: 30px;


color: white;

text-decoration: none;

text-align: center;

line-height: 30px;


border-radius: 5px;

}


#reset-button{

left: 100px;

bottom: 20px;

background-color: #058;

}


#reset-button:hover{

background-color: #047;

}


#show-button{

right: 100px;

bottom: 20px;

background-color: #085;

}


#show-button:hover{

background-color: #074;

}

js腳本(blur.js)

var canvasWidth = 600;

var canvasHeight = 450;


var canvasObj = document.getElementById("blur-canvas");


var contextObj = canvasObj.getContext("2d");


canvasObj.width = canvasWidth;

canvasObj.height = canvasHeight;


var imageObj = new Image();

var radius = 50;

var clippingRegion = {x:200,y:100,r:radius}


imageObj.src = "20170122161717.png";

imageObj.onload = function(e){

initCanvas();

}



function initCanvas(){

var rx = Math.random()*(canvasObj.width - 2*radius)+radius;

var ry = Math.random()*(canvasObj.height - 2*radius)+radius;

clippingRegion = {x:rx,y:ry,r:radius};

drawImage(imageObj,clippingRegion);

}



function drawImage(imageObj,clippingRegion){

contextObj.clearRect(0,0,canvasObj.width,canvasObj.height);


contextObj.save();

setClippingRegion(clippingRegion);

contextObj.drawImage(imageObj,0,0);

contextObj.restore();

}



function setClippingRegion(clippingRegion){

contextObj.beginPath();

contextObj.arc(clippingRegion.x,clippingRegion.y,clippingRegion.r,0,Math.PI*2,false);

contextObj.clip();

}



function reset(){

initCanvas();

}



function show(){

document.getElementById("reset-button").style.display="none";

var animation = setInterval(function(){

clippingRegion.r += 20;

if (clippingRegion.r > 2*Math.max(canvasObj.width,canvasObj.height)) {

clearInterval(animation);

document.getElementById("reset-button").style.display="block";

}

drawImage(imageObj,clippingRegion);

},30);

}

紅包照片模糊效果

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

永年县| 宿州市| 仪征市| 马龙县| 普兰店市| 于都县| 渝中区| 大城县| 本溪市| 大洼县| 温泉县| 城口县| 潍坊市| 广西| 息烽县| 临江市| 聂拉木县| 洞头县| 英山县| 牟定县| 科尔| 靖宇县| 柳河县| 沂源县| 信丰县| 习水县| 湘乡市| 雷州市| 新巴尔虎左旗| 五莲县| 溧水县| 苏尼特右旗| 二连浩特市| 桦川县| 永清县| 克拉玛依市| 德令哈市| 盐边县| 新平| 南岸区| 皋兰县|