支持Chrome:

暂不支持浏览器:FF,IE...

希望后者努力

效果图:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZGFteXM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">

CSS:

<style type="text/css">
@-webkit-keyframes testAnim {
0% {-webkit-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-webkit-filter: grayscale(0.2) blur(6px) saturate(9);}
} /*IE,FF暂不支持*/
@-moz-keyframes testAnim {
0% {-moz-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-moz-filter: grayscale(0.2) blur(6px) saturate(9);}
} @-ms-keyframes testAnim {
0% {-ms-filter: grayscale(0.5) blur(1px) saturate(2);}
100% {-ms-filter: grayscale(0.2) blur(6px) saturate(9); }
} @keyframes testAnim {
0% {filter: grayscale(0.5) blur(1px) saturate(2);}
100% {filter: grayscale(0.2) blur(6px) saturate(9);}
} #animatePhoto {}
.animatePhoto:hover,#animatePhoto:hover{
-webkit-animation-name: testAnim;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s; /*IE,FF暂不支持*/
-moz-animation-name: testAnim;
-moz-animation-duration: 2s;
-moz-animation-iteration-count: 1;
-moz-animation-direction: alternate;
-moz-animation-timing-function: ease-out;
-moz-animation-fill-mode: forwards;
-moz-animation-delay: 0s; -ms-animation-name: testAnim;
-ms-animation-duration: 2s;
-ms-animation-iteration-count: 1;
-ms-animation-direction: alternate;
-ms-animation-timing-function: ease-out;
-ms-animation-fill-mode: forwards;
-ms-animation-delay: 0s; animation-name: testAnim;
animation-duration: 2s;
animation-iteration-count: 1;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 0s;
}
.l,.r{ width:40%; float:left; padding:40px;}
</style>

HTML:

<div class="l">
<h3>图片滤镜特效试验</h3>
<img id="fxPhoto" src="http://avatar.csdn.net/A/7/9/1_damys.jpg" />
<div id="sliderContainer"></div>
</div> <div class="r">
<h3>图片滤镜特效试验:hover</h3>
<img id="animatePhoto" class="animatePhoto" src="http://avatar.csdn.net/A/7/9/1_damys.jpg" />
</div>

JS:拖动效果

<script type="text/javascript">
var photo = jQuery("#fxPhoto");
var filters = [
{ name: "grayscale", cname: "黑白照片(灰度级)效果", def: "0", unit: "", min:0 , max:1.0, step: "0.01" },
{ name: "blur", cname: "模糊效果", def: "0", unit: "px", min: 0, max: 10 , step: "1"},
{ name: "sepia", cname: "老照片(褐黄色)效果", def: "0", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "saturate", cname: "饱和度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "opacity", cname: "透明度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "brightness", cname: "亮度调整", def: "1", unit: "", min: 0, max: 1.0 , step: "0.01"},
{ name: "contrast", cname: "对照度调整", def: "1", unit: "", min: 0, max: 1 , step: "0.01"},
{ name: "hue-rotate", cname: "色调调整", def: "0", unit: "deg", min: 0, max: 360 , step: "1"},
{ name: "invert", cname: "色彩反相", def: "0", unit: "", min: 0, max: 1.0 , step: "0.01"}
]; // Change event
function onChange() {
var cssString = ""; jQuery.each(filters, function() {
var value = jQuery('#'+this.name).val();
// Update the value title
jQuery('#title_'+this.name).html("<h3>" + this.cname + "(" + this.name + ":" +value + this.unit + ")</h3>"); // Update CSS string
cssString += " " + this.name + "(" + value + this.unit + ")";
});
photo.attr('style', "-webkit-filter: " + cssString);
} // For every filter
var container = jQuery("#sliderContainer");
jQuery.each(filters, function() {
container.append("<p id='title_"+this.name+"'>"+this.cname+"</p>");
container.append("<input onChange='onChange()' value='"+this.def+"' type='range' id='"+this.name+"' min='"+this.min+"' max='"+this.max+"' step='"+this.step+"'>");
}); onChange();
</script>

HTML5----CSS3图片滤镜(filter)特效的更多相关文章

  1. 基于HTML5/CSS3图片网格动画特效

    现在HTML5技术可以让网页上的图片变得非常神奇,各种各样的HTML5图片动画特效让你眼花缭乱.今天要分享的这款HTML5图片网格动画特效就非常炫酷.图片缩略图按网格的布局一行行排列,你只需点击按钮即 ...

  2. css3图片模糊过滤特效

    体验效果:点击这里查看效果 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...

  3. 精选 5 个漂亮的 CSS3 图片滑过特效

    这篇文章将为大家分享5款漂亮的CSS3图片滑过特效,比如滑过后显示图片的详细文字介绍,又比如滑过后对图片进行淡入淡出的效果等等.让我们一起来看看,喜欢的朋友赶紧收藏. 1.非常酷的CSS3图片说明效果 ...

  4. CSS3的滤镜filter属性

    css3的滤镜filter属性,可以对网页中的图片进行类似Photoshop图片处理的效果,例如背景的毛玻璃效果.老照片(黑白照片).火焰效果等. 一.blur(px)高斯模糊 二.brightnes ...

  5. 9款超绚丽的HTML5/CSS3应用和动画特效

    1.CSS3飘带状3D菜单 菜单带小图标 这次我们要来分享一款很特别的CSS3菜单,菜单的外观是飘带状的,并且每一个菜单项有一个精美的小图标,鼠标滑过菜单项时,菜单项就会向上凸起,像是飘带飘动一样,形 ...

  6. 基于CSS3图片悬停放大特效

    今天我们要来分享一款很酷的CSS3图片特效,这款图片特效可以利用鼠标滑过图片使其悬停放大,并使图片的周围出现发光的效果.配合黑色的背景,这款CSS3图片悬停放大效果显得更加立体大气,非常适合产品图片的 ...

  7. html5+css3图片旋转特效

    <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8" ...

  8. css3图片滤镜

    http://www.zhanxin.info/development/2012-12-19-css-filter.html

  9. HTML5/CSS3图片左右切换弹性动画

    在线演示 本地下载

随机推荐

  1. 花括号的使用 printf %${width}s , 否则会 去找 $widths

    花括号的使用  printf %${width}s , 否则会 去找  $widths 1 #! /usr/bin/perl   2 use strict;  3 use warnings;  4   ...

  2. 第2节 mapreduce深入学习:12、reducetask运行机制(多看几遍)

    ReduceTask的运行的整个过程 背下来1.启动线程到mapTask那里去拷贝数据,拉取属于每一个reducetask自己内部的数据2.数据的合并,拉取过来的数据进行合并,合并的过程,有可能在内存 ...

  3. python Matplotlib 系列教程(三)——绘制直方图和条形图

    在本章节我们将学习如何绘制条形图和直方图 条形图与直方图的区别:首先,条形图是用条形的长度表示各类别频数的多少,其宽度(表示类别)则是固定的: 直方图是用面积表示各组频数的多少,矩形的高度表示每一组的 ...

  4. 动态 SQL(1)

    使用动态 SQL 完成多条件查询 动态 SQL 是 MyBatis 的一个强大的特性.在使用 JDBC 操作数据时,如果查询条件特别多,将条件串联成 SQL 字符串是一件痛苦的事情,通常的解决方法是写 ...

  5. [Python3网络爬虫开发实战] 1.9.6-Gerapy的安装

    Gerapy是一个Scrapy分布式管理模块,本节就来介绍一下它的安装方式. 1. 相关链接 GitHub:https://github.com/Gerapy 2. pip安装 这里推荐使用pip安装 ...

  6. LINUX系统---中级相关操作和知识

    LINUX系统的中级,来搞一些LINUX安全相关的东西,还有在公司生成中长搞的集群. RHCS集群 什么是高可用 什么是热备 什么是分布式

  7. list & dictionary

    list不能直接进行对应,dictionary可以 list用[],dictionary用{}

  8. 74-A/D指标,Accumulation/Distribution,积累/派发线,离散指标.(2015.7.1)

    A/D指标,Accumulation/Distribution 积累/派发线,离散指标 观井映天 2015.7.1

  9. unity 菜单栏添加新菜单

    using UnityEngine; using System.Collections; using UnityEditor; public class jqmTools : CreateSphere ...

  10. C51 原创电子琴 (蜂鸣器/计时器/中断/矩阵按键)

    需求分析 用C51的16个矩阵按键当作两个八度的琴键 按下时发出相应音调的声音,静态数码管显示相应音符的数字. 为了解锁更多曲目,两个多的琴键设计成#4,显示时加上小数点 下图分别为1和#4的显示,其 ...