2012-03-02 74 views
2

我需要JS腳本,這將改變圖像/ HTML在這個 「水波紋」 樣式:使用Javascript - 水波紋效果

http://fcunited.ru/_temp/listening2.gif

任何LIB(對不起,6MB GIF文件!)?我只發現這個:http://code.almeros.com/code-examples/water-effect-canvas/#.T1DPAXmuG_R

但這並不是我所需要的。

+0

該圖像需要很長時間才能加載(我從服務器獲取的速度低於25 kb/s)。有沒有機會將其上傳到圖像主機?其他人可以用更短的加載時間更快地回答。 – Smamatti 2012-03-02 14:12:52

+0

已將圖像上傳到我的主機。 – fcunited 2012-03-02 14:21:00

回答

5

如果HTML5是一個選項(取代用帆布加載圖像的圖像),則可能能夠提取從演示這種效果和在尺寸和位置調整效果(包括源代碼):

http://js1k.com/2010-first/demo/131

0
.paperButton { 
    display: block; 
    text-align: center; 
    text-decoration: none; 
    position: relative; 
    overflow: hidden; 
    -webkit-transition: all 0.2s ease; 
    -moz-transition: all 0.2s ease; 
    -o-transition: all 0.2s ease; 
    transition: all 0.2s ease; 
    z-index: 0; 
    cursor:pointer; 
} 
.animate { 
    -webkit-animation: ripple 0.65s linear; 
    -moz-animation: ripple 0.65s linear; 
    -ms-animation: ripple 0.65s linear; 
    -o-animation: ripple 0.65s linear; 
    animation: ripple 0.65s linear; 
} 
@-webkit-keyframes 
ripple { 100% { 
opacity: 0; 
-webkit-transform: scale(2.5); 
} 
} 
@-moz-keyframes 
ripple { 100% { 
opacity: 0; 
-moz-transform: scale(2.5); 
} 
} 
@-o-keyframes 
ripple { 100% { 
opacity: 0; 
-o-transform: scale(2.5); 
} 
} 
@keyframes 
ripple { 100% { 
opacity: 0; 
transform: scale(2.5); 
} 
} 


$(function(){ 
    var ink, i, j, k; 
    $(".paperButton").mousedown(function(e){  
      if($(this).find(".ink").length === 0){ 
       $(this).prepend("<span class='ink'></span>"); 
      } 

      ink = $(this).find(".ink"); 
      ink.removeClass("animate"); 

      if(!ink.height() && !ink.width()){ 
       i = Math.max($(this).outerWidth(), $(this).outerHeight()); 
       ink.css({height: i, width: i}); 
      } 

      j = e.pageX - $(this).offset().left - ink.width()/2; 
      k = e.pageY - $(this).offset().top - ink.height()/2; 

      ink.css({top: k+'px', left: j+'px'}).addClass("animate"); 

}); 
}); 
+0

用你的代碼添加一些解釋 – 999k 2014-12-15 09:34:01