前言

好久没有写博客啦,高亮文字和图片一闪而过的特效,用CSS3来写

先看文字吧,

就上代码了

.shadow {
/* 背景颜色线性渐变 */
/* 老式写法 */
/* linear为线性渐变,也可以用下面的那种写法。left top,right top指的是渐变方向,左上到右上 */
/* color-stop函数,第一个表示渐变的位置,0为起点,0.5为中点,1为结束点;第二个表示该点的颜色。所以本次渐变为两边灰色,中间渐白色 */
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0, #4d4d4d),
color-stop(0.4, #4d4d4d),
color-stop(0.5, white),
color-stop(0.6, #4d4d4d),
color-stop(1, #4d4d4d)
);
/* 设置为text,意思是把文本内容之外的背景给裁剪掉 */
-webkit-background-clip: text;
/* 设置对象中的文字填充颜色 这里设置为透明 */
-webkit-text-fill-color: transparent;
/* 每隔2秒调用下面的CSS3动画 infinite属性为循环执行animate */
-webkit-animation: animate 1.5s infinite;
animation: animate 1.5s infinite;
}
@keyframes animate {
from {
background-position: -100px;
}
to {
background-position: 100px;
}
}
  <span class="shadow">2019你好</span>

图片呢:别急

<div class="img"><img src="https://cdndaily.quickbass.com/o2o/merchant/3/1811261526335TMQpr9Y!r750x380">
<div class="rolled"></div>
</div>

介绍2种吧:

1种是无限循环

.img {
display: block;
position: relative;
width: 800px;
height: 450px;
margin: 0 auto;
} body {
margin:;
padding:;
} .img:hover .rolled {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
-ms-animation-play-state: paused;
} .rolled {
position: absolute;
top:;
width: 80px;
height: 500px;
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0)0, rgba(255, 255, 255, .2)50%, rgba(255, 255, 255, 0)100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(50%, rgba(255, 255, 255, .2)), color-stop(100%, rgba(255, 255, 255, 0)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0)0, rgba(255, 255, 255, .2)50%, rgba(255, 255, 255, 0)100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 0)0, rgba(255, 255, 255, .2)50%, rgba(255, 255, 255, 0)100%);
-webkit-transform: skewX(-25deg);
-moz-transform: skewX(-25deg);
-webkit-animation: rolled 2.5s .2s ease both infinite;
-moz-animation: rolled 2.5s .2s ease both infinite;
-o-animation: rolled 2.5s .2s ease both infinite;
-ms-animation: rolled 2.5s .2s ease both infinite;
overflow: hidden;
} @-webkit-keyframes rolled {
0% {
left: -150px;
} 100% {
left: 920px;
}
} @-moz-keyframes rolled {
0% {
left: -150px;
} 100% {
left: 920px;
}
} @-o-keyframes rolled {
0% {
left: -150px;
} 100% {
left: 920px;
}
} @-ms-keyframes rolled {
0% {
left: -150px;
} 100% {
left: 920px;
}
} @keyframes rolled {
0% {
left: -150px;
} 100% {
left: 920px;
}
}

2种是就 执行一次

.img:before {
content: ""; position: absolute; width:200px; height: 100%; top:; left: -150px; overflow: hidden; background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(50%, rgba(255,255,255,.2)), color-stop(100%, rgba(255,255,255,0)));/*老式语法书写规则*/ background: -moz-linear-gradient(left, rgba(255,255,255,0)0, rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%);
background: -webkit-linear-gradient(left, rgba(255,255,255,0)0, rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%);
background: -o-linear-gradient(left, rgba(255,255,255,0)0, rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%); -webkit-transform: skewX(-25deg);
-moz-transform: skewX(-25deg) }
.img:hover:before { left: 150%; transition: left 1s ease 0s; }

CSS3动画实现高亮光弧效果,文字和图片(一闪而过)的更多相关文章

  1. 用CSS3动画特效实现弹窗效果

    提示:如果大家觉得本篇实现的弹窗效果有用,可持续关注.接下会添加更多效果并且封装成插件,这样使用就方便了.效果查看: https://heavis.github.io/hidialog/index.h ...

  2. CSS3动画中的animation-timing-function效果演示

    CSS3动画(animation)属性有如下几个: 属性 值 说明 animation-name name 指定元素要使用的keyframes名称 animation-duration time(ms ...

  3. css3动画实现伪弹幕效果

    如图所示: 效果还可以直接用麦唱APP把一首歌分享到微信里面看到,方法类似全民K歌的方法,都是用css3动画实现的, 代码如下:(这是我做真实效果前的一个dome) 直接粘代码就可以看到效果,里面有两 ...

  4. css3动画(animation)效果3-正方体合成

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

  5. css3动画(animation)效果1-漂浮的白云

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

  6. css3动画(animation)效果2-旋转的星球

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

  7. CSS3动画设置后台登录页背景切换图片

    CSS3的动画很实用很好用,简单几句话就可以做出一个好看而且过渡平滑的body背景图片,不多说,来来来,上代码 body{ animation:mybg 7s; -webkit-animation:m ...

  8. 超酷震撼 HTML5/CSS3动画应用及源码

    HTML5可以制作非常华丽的动画效果,这点通过之前的分享学习我们已经有深刻的了解了,今天我们主要来分享一些HTML5结合CSS3形成的超炫震撼的动画应用以及它们的源代码,真的非常不错. 1.纯CSS3 ...

  9. wow.js让css3动画变动更有趣(滚动页面动画模拟懒加载特效)

    CSS3的出现给网站页面增加了活力,网站增色不少,有这么小小的一款插件就能做出很多动画效果. 最重要的是它:简单易用.轻量级.无需 jQuery......他就是wow.js 地址:https://d ...

随机推荐

  1. 关于Thread ThreadPool Parallel 的一些小测试demo

    using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading ...

  2. Go语言中 Print,Println 和 Printf 的区别(八)

    Print 和 Println 这两个打印方式类似,只在格式上有区别 1. Println 打印的每一项之间都会有空行,Print 没有,例如: fmt.Println("go", ...

  3. 初入JavaWeb(半成品)

    2019-10-21 20:51:03 初次进行Javaweb的开发. 要求: 1登录账号:要求由6到12位字母.数字.下划线组成,只有字母可以开头:(1分) 2登录密码:要求显示“• ”或“*”表示 ...

  4. acmsguru

    acmsguru 101 - Domino 要求每两个相邻的多尼诺骨牌相对的数字相同,即做一个一笔画 #include<bits/stdc++.h> using namespace std ...

  5. python_0基础开始_day11

    第十一节 一,函数名的第一类对象 函数名当作值,赋值给变量 print(函数名) 查看看书的内存地址 函数名可以当作容器中的元素 lis = []dic = {}def func():    prin ...

  6. SpringMVC实现全局异常处理器 (转)

    出处:  SpringMVC实现全局异常处理器 我们知道,系统中异常包括:编译时异常和运行时异常RuntimeException,前者通过捕获异常从而获取异常信息,后者主要通过规范代码开发.测试通过手 ...

  7. Linux shellcode sample

    Linux shellcode sample HelloWorld.nasm ;HelloWorld.asm ;Author: Kul Subedi global _start section .te ...

  8. [转载]static in Java

    来源:https://www.cnblogs.com/chenssy/p/3386721.html 一. static代表着什么 在Java中并不存在全局变量的概念,但是我们可以通过static来实现 ...

  9. java实现spark常用算子之mapPartitions

    import org.apache.spark.SparkConf;import org.apache.spark.api.java.JavaRDD;import org.apache.spark.a ...

  10. MyBatis与Hibernate总结篇

    也用了这么久的Hibernate和MyBatis了,一直打算做一个总结,就他们之间的优缺点说说我自己的理解: 首先,Hibernate是一个ORM的持久层框架,它使用对象和我们的数据库建立关系,在Hi ...