可控制转速CSS3旋转风车特效

以前制作网页动画一般使用javascript,现在已经有越来越多动动画使用纯CSS实现,并且动画的控制也可以使用CSS3实现,因为CSS3来了,CSS3的动画功能确实强大。以下是一个纯CSS3制作

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

以前制作网页动画一般使用javascript,现在已经有越来越多动动画使用纯CSS实现,并且动画的控制也可以使用CSS3实现,因为CSS 3来了,CSS 3的动画功能确实强大。以下是一个纯CSS3制作的风车旋转动画,而且也用CSS 3控制速度。

体验效果:
http://hovertree.com/texiao/css3/40/

效果图:
可控制转速CSS3旋转风车特效

可以看到,风车的叶片是三角形,使用css画各种图形请参考:
http://hovertree.com/h/bjaf/jtkqnsc1.htm
http://hovertree.com/h/bjaf/ltgc20vn.htm

css制作动画是用到了animation属性,请参考:
http://hovertree.com/h/bjaf/i309b77d.htm
http://hovertree.com/h/bjaf/fwck53gt.htm
http://hovertree.com/h/bjaf/xpxgjfap.htm
http://hovertree.com/h/bjaf/kqud99m6.htm

扇叶的旋转使用到了transform属性,参考:
http://hovertree.com/h/bjaf/c3bshswk.htm
http://hovertree.com/h/bjaf/lxsexx3m.htm

本示例用到了CSS 3的选择器nth-of-type,参考:
http://hovertree.com/h/bjaf/c2c0k0tf.htm

下面给出本示例的代码:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>可控制转速CSS3旋转风车特效 - 何问起</title>
<link rel="stylesheet" href="http://hovertree.com/texiao/css3/40/style/hovertreespin.css">
</head>
<body>
<div class="wrapper">
    <div class="pin-layout">
        <a href="#" class="control">暂停</a>
        <a href="#" class="control">旋转</a>
        <a href="#" class="control">中速</a>
        <a href="#" class="control">高速</a>
        <div class="pillar">
            <div class="dot"></div>
            <span class="item1"></span>
            <span class="item2"></span>
            <span class="item3"></span>
            <span class="item4"></span>
        </div>
    </div>
    <p><b>何问起温馨小提示:</b>暂停后点击页面任何区域都可自动旋转哦!</p>
</div><!-- end wrapper -->
<div style="text-align:center;margin:100px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用于支持CSS3的浏览器。</p>
<p>来源:<a href="http://hovertree.com/" target="_blank">何问起</a> <a href="http://hovertree.com/h/bjag/efqb2w4s.htm" target="_blank">说明</a></p>
</div>
</body>
</html>

CSS文件代码:

*{margin:0; padding:0;}
body{background:#eee;width:100%; height:100%;}
.wrapper{
    position: relative;
    width: 800px;
    height:450px;
    margin:60px auto 0;
}
.wrapper .pin-layout{
    position: absolute;
    bottom: 0;
    left: calc(50% - 20px);
    width:40px;
    height:280px;
}
.wrapper .pin-layout::after{
    position:absolute;
    bottom:0;
    left: calc(50% - 20px);
    content:"";
    height:0;
    width:10px;
    border-width: 0px 15px 280px 15px;
    border-style:solid;
    border-color:transparent transparent #6B3500 transparent;
}
.wrapper .pin-layout .pillar{
    position: absolute;
    top: -18px;
    left: calc(50% - 18px);
    width:36px;
    height:36px;
    z-index: 9;
    transform: rotateZ(45deg);
    transition:all .9s linear;
    animation: hovertreespin 3s linear 0s infinite;
}
.pin-layout .control:hover::after{
    position: absolute;
    left: 0;
    content: "";
    width: 100%;
    height:100%;
    background: rgba(0,0,0,.3);
}
.pin-layout .control{
    position: absolute;
    bottom:0;
    width: 80px;
    height:30px;
    line-height:30px;
    border: 1px solid #ADADAD;
    border-radius: 4px;
    text-align:center;
    text-decoration:none;
    letter-spacing:2px;
    color: white;
    background: red;
}
.pin-layout .control:nth-of-type(1){
    left: -100px;
}
.pin-layout .control:nth-of-type(3):focus ~ .pillar{
    animation-duration:.8s;
}
.pin-layout .control:nth-of-type(4):focus ~ .pillar{
    animation-duration:.2s;
}
.pin-layout .control:nth-of-type(2){
    right: -100px;
    background: green;
}
.pin-layout .control:nth-of-type(3){
    bottom: -40px;
    left: -100px;
    background: #037862;
}
.pin-layout .control:nth-of-type(4){
    bottom: -40px;
    right: -100px;
    background: #036B3E;
}
.pin-layout .control:nth-of-type(1):focus ~ .pillar{
    animation-play-state:paused;
}
.pin-layout .control:nth-of-type(2):focus ~ .pillar{
    animation-play-state:running;
}
 .pin-layout .pillar span[class^="item"]{
    position: absolute;
     top: calc(-200px + 18px);
    left: 18px;
    border-width:0px 80px 200px 0px;
    border-style:solid;
 }
 .pin-layout .pillar span[class^="item"]:nth-of-type(1){
    z-index:1;
    border-color:transparent transparent dodgerblue transparent;
    /*border-color:green red gray blue;*/
}
 .pin-layout .pillar span[class^="item"]:nth-of-type(2){
    z-index:2;
    border-color:transparent transparent orangered transparent;
    transform-origin:left bottom;
    transform: rotateZ(90deg);
}
 .pin-layout .pillar span[class^="item"]:nth-of-type(3){
    z-index:3;
    border-color:transparent transparent greenyellow transparent;
    transform-origin:left bottom;
    transform: rotateZ(180deg);
}
 .pin-layout .pillar span[class^="item"]:nth-of-type(4){
    z-index:4;
    border-color:transparent transparent mediumpurple transparent;
    transform-origin:left bottom;
    transform: rotateZ(270deg);
}
.wrapper .pin-layout .pillar .dot{
    position: absolute;
    top: 0;
    left: 0;
    border-width: 19px;
    border-style: solid;
    border-color: #3C0505 transparent #3C0505 transparent;
    border-radius:50%;
    background:#F505EE;
    z-index:1999;
    box-shadow:0 0 2px #1A0505;
}
@keyframes hovertreespin {
    0%{
        transform: rotate(0deg)
    }
    100%{
        transform:rotate(360deg);
    }
}

使用图片扇叶的风车:
http://hovertree.com/h/bjaf/h9tb5itb.htm

特效集合:

http://www.cnblogs.com/roucheng/p/texiao.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/120270.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 应用var模型时的15个注意点_应用相对数时的注意事项

    应用var模型时的15个注意点_应用相对数时的注意事项转载自:http://bbs.pinggu.org/forum.php?mod=viewthread&tid=3219921&ctid=2272向量自回归(VAR,VectorAutoregression)常用于预测相互联系的时间序列系统以及分析随机扰动对变量系统的动态影响。VAR方法通过把系统中每一个内生变量,作为系统中所有内生变量的滞后值的函数来构造模型,从而回避了结构化模型的要求。E

    2025年6月15日
    3
  • 管家婆crm9.2 sp2升级问题求助及解决方案

    管家婆crm9.2 sp2升级问题求助及解决方案

    2021年11月17日
    52
  • 腾讯股票数据接口

     0:未知 1:名字:name 2:代码:code 3:现价:trade 4:昨收:yestclose 5:今开:open 6:成交量(手):volume 7:外盘 8:内盘 9:买一10:买一量(手)11-18:买二买五19:卖一20:卖一量21-28:卖二卖五29:最近逐笔成交30:时间31:涨跌:change32:涨跌幅:changepercent33:最高:high34:最低:low3…

    2022年4月8日
    183
  • RTP协议头详解

    RTP协议头详解1.RTP协议RTP:即可心跑在TCP也可以跑在UDP上,实时流协议,所以通常是跑在UDP上。前12个字节出现在每个RTP包中,仅仅在被混合器插入时,才出现CSRC识别符列表。各个域的含义如下所示:(1)版本(V):2比特,此域定义了RTP的版本。此协议定义的版本是2。(值1被RTP草案版本使用,值0用在最初”vat”语音工具使用的协议中。)(2)填充(P):1比特,若填料比特被设置,则此包包含一到多个附加在末端的填充比特,填充比特不算作负载的一部分。填

    2022年6月28日
    49
  • 原码反码补码运算规则_正数的原码反码补码相同吗

    原码反码补码运算规则_正数的原码反码补码相同吗一.机器数和真值在学习原码,反码和补码之前,需要先了解机器数和真值的概念.1、机器数一个数在计算机中的二进制表示形式,叫做这个数的机器数。机器数是带符号的,在计算机用一个数的最高位存放符号,正数为0,负数为1.比如,十进制中的数+3,计算机字长为8位,转换成二进制就是00000011。如果是-3,就是10000011。那么,这里的00000011和10000011就是机器数。2、因为第一位是符号位,所以机器数的形式值就不等于真正的数值。例如上面的有符号数100

    2022年9月23日
    3
  • GC算法[通俗易懂]

    GC算法[通俗易懂]JVM(JavaVirtualMachine) GC是什么?频繁收集Young区 较少收集Old区 基本不动Perm区  JVM在进行GC时,并非每次都对上面三个内存区域一起回收的,大部分时候回收的都是指新生代,因此GC按照回收的区域又分了两种类型,一种是普通GC(minorGC),一种是全局GC(majorGCorFullGC) 普通GC(…

    2022年6月29日
    28

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号