clip-path

属性介绍:

clip-path属性可以创建一个只有元素的部分区域可以显示的剪切区域。

区域内的部分显示,区域外的隐藏。

剪切区域是被引用内嵌的URL定义的路径或者外部svg的路径。

使用:

不可思议的CSS之clip-path

css中clip-path属性的运用

具体还支持SVG路径

maker工具,你画好图形,代码就在下面: http://bennettfeely.com/clippy/

主流浏览器支持情况:

效果实现:

html:

<div></div>

css:

html,
body {
  height: 100%;
}

body {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  background: #999999;
}

div {
  width: 75vmin;
  height: 75vmin;
  -webkit-animation: shape 10s ease-in-out infinite both;
  animation: shape 10s ease-in-out infinite both;
}

@-webkit-keyframes shape {

  from,
  to {
    -webkit-clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    background: url('./267323.jpg') center;
  }

  14.28571% {
    -webkit-clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    background: url('./267323.jpg') left top;
  }

  28.57143% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0 60%, 10% 20%);
    clip-path: polygon(50% 0, 50% 0, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0 60%, 10% 20%);
    background: url('./267323.jpg') right bottom;
  }

  42.85714% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 25%, 100% 75%, 50% 100%, 50% 100%, 0 75%, 0 25%);
    clip-path: polygon(50% 0, 50% 0, 100% 25%, 100% 75%, 50% 100%, 50% 100%, 0 75%, 0 25%);
    background: url('./267323.jpg') left bottom;
  }

  57.14286% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 38%, 100% 38%, 82% 100%, 18% 100%, 0 38%, 0 38%);
    clip-path: polygon(50% 0, 50% 0, 100% 38%, 100% 38%, 82% 100%, 18% 100%, 0 38%, 0 38%);
    background: url('./267323.jpg') right top;
  }

  71.42857% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0);
    clip-path: polygon(50% 0, 50% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0);
    background: url('./267323.jpg') right right;
  }

  85.71429% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 50% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 50% 0);
    clip-path: polygon(50% 0, 50% 0, 50% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 50% 0);
    background: url('./267323.jpg') left center;
  }
}

@keyframes shape {

  from,
  to {
    -webkit-clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    background: url('./267323.jpg') center;
  }

  14.28571% {
    -webkit-clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    background: url('./267323.jpg') left top;
  }

  28.57143% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0 60%, 10% 20%);
    clip-path: polygon(50% 0, 50% 0, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0 60%, 10% 20%);
    background: url('./267323.jpg') right bottom;
  }

  42.85714% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 25%, 100% 75%, 50% 100%, 50% 100%, 0 75%, 0 25%);
    clip-path: polygon(50% 0, 50% 0, 100% 25%, 100% 75%, 50% 100%, 50% 100%, 0 75%, 0 25%);
    background: url('./267323.jpg') left bottom;
  }

  57.14286% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 38%, 100% 38%, 82% 100%, 18% 100%, 0 38%, 0 38%);
    clip-path: polygon(50% 0, 50% 0, 100% 38%, 100% 38%, 82% 100%, 18% 100%, 0 38%, 0 38%);
    background: url('./267323.jpg') right top;
  }

  71.42857% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0);
    clip-path: polygon(50% 0, 50% 0, 100% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 0);
    background: url('./267323.jpg') right right;
  }

  85.71429% {
    -webkit-clip-path: polygon(50% 0, 50% 0, 50% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 50% 0);
    clip-path: polygon(50% 0, 50% 0, 50% 0, 100% 100%, 100% 100%, 0 100%, 0 100%, 50% 0);
    background: url('./267323.jpg') left center;
  }
}

CSS3 之高级动画(6)CSS3 clip-path属性实现的几何图形变形动画的更多相关文章

  1. Unity插件 - MeshEditor(六) 变形动画状态机

    变形动画状态机--MeshAnimator,是针对MeshAnimation的状态管理器,有大量类似Unity animator的功能,但MeshAnimator操作会更加简便,更加直观,居家旅(zh ...

  2. CSS3实践之路(六):CSS3的过渡效果(transition)与动画(animation)

    刚开始W3C CSS Workgroup拒绝将CSS3 transition与animation加入官方标准,一些成员认为过渡效果和动画并非样式属性,而且已经可以用脚本实现.所以请大家明白,特别是We ...

  3. CSS3展现精彩的动画效果 css3的动画属性

    热火朝天的css3无疑吸引了很多前端开发者的眼球,然而在css3中的动画属性则是新功能中的主打招牌,说到css3的动画属性不得不让人想起这三个属性:Transform﹑Transition﹑Anima ...

  4. css3学习--css3动画详解一(animation属性)

    ***介绍的属性并不完全,写的都是我认为容易混淆的难点属性,所以属性会在最后综合案例展示~ 一.Keyframes介绍: Keyframes被称为关键帧,其类似于Flash中的关键帧.在CSS3中其主 ...

  5. (一)CSS3动画应用 - CSS3 实现 侧边栏展开收起

    @keyframes 规则用于创建动画. @keyframes 中规定某项 CSS 样式,就能创建由当前样式逐渐改为新样式的动画效果 @keyframes 中创建动画时,请把它捆绑到某个选择器,否则不 ...

  6. CSS3集锦之新增选择器、圆角、阴影、透明度、transition动画、transform变形、animation动画

    ---恢复内容开始--- 一.CSS3新增选择器 1.nth-chlid(n)用法 selector:nth-chlid(n)指找到第n个子元素并且该元素为selector标签 <!DOCTYP ...

  7. 关于JS动画和CSS3动画的性能差异

    本文章为综合其它资料所得. 根据Google Developer,Chromium项目里,渲染线程分为main thread和compositor thread. 如果CSS动画只是改变transfo ...

  8. CSS3 基本属性 浅析(含选择器、背景阴影、3D转换、动画等)

    1渐进增强原则 2私有前缀  不同浏览器在发布不同版本(一般测试版)时会加前缀,新增属性加上前缀进行支持测试:     Chrome浏览器:-webkit-border-radius: 5px;   ...

  9. 使用jquery封装的动画脚本(无动画、css3动画、js动画)

    自己封装好的showhide.js 包含无动画.css3动画.js动画 包括:fade(淡入淡出)  slideUpDown(上下滑动)  slideLeftRight(左右滑动)  fadeSlid ...

随机推荐

  1. Spring任务调度实战之Quartz Cron Trigger

    在Quartz中除了使用最简单的Simple Trigger以外,也可以使用类似Linux上Cron作业的CronTrigger的方式来运行Job,下面是一个小例子: 1. 首先是一个任务类,这个类没 ...

  2. sklearn的train_test_split()各函数参数含义解释(非常全)

    sklearn之train_test_split()函数各参数含义(非常全) 在机器学习中,我们通常将原始数据按照比例分割为“测试集”和“训练集”,从 sklearn.model_selection ...

  3. MySQL查询事务 杀死事务

    遇到 com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock 查询: SELECT * FROM inf ...

  4. 第1节 IMPALA:7、impala的安装以及配置过程

    6.制作本地yum源 镜像源是centos当中下载相关软件的地址,我们可以通过制作我们自己的镜像源指定我们去哪里下载impala的rpm包,这里我们使用httpd这个软件来作为服务端,启动httpd的 ...

  5. py交易

    下载之后发现是pyc文件,反编译一下 网站:https://tool.lu/pyc/ 发现其实就是base64转换为16进制,然后减去16再和32异或,就可以得到答案了 nctf{d3c0mpil1n ...

  6. JS: 复选框——ALL与A、B、C(选中ALL同时选中各子项)

    <!DOCTYPE html><html> <head>  <meta charset="utf-8">  <title> ...

  7. SQL注入过WAF(11.4 第三十三天)

    WAF是什么? Web应用防护系统(也称:网站应用级入侵防御系统.英文:Web Application Firewall,简称: WAF).也叫Web防火墙,主要是对Web特有入侵方式的加强防护,如D ...

  8. C++学习记录——(queue的清空)

    c++自带的queue并没有clear这个方法:所以只能自己写了. 一共三种(其实我决得就是两种): 第一种: 直接赋值 queue<int> MyQue; /* …… */ MyQue ...

  9. 关于SSM中mybatis向oracle添加语句采用序列自增的问题

    在SSM向oracle数据库中插入语句时,报错如下: ### Error updating database.  Cause: java.sql.SQLException: 不支持的特性 ### SQ ...

  10. 批量处理文件的Python程序

    经常批量处理文件,这里有个python的模板,保存一下 这个例子是把目录里面所有子目录的mp3文件放慢0.85倍并保存到./processed/目录下面. #coding=utf-8 import s ...