Coder往事之: 一些炫酷的特效 for web 前端 (一)

10 篇文章 0 订阅
5 篇文章 0 订阅

群星环绕

群星环绕

html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>星星环绕</title>
        <link rel="stylesheet" href="css/index.css" />
        <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
    </head>
    <body>
        <!--
            作者:352183987@qq.com
            时间:2018-01-09
            描述:群星环绕
        -->
        <center>
            <h1>我是一个<span>被施了魔法的</span>皮皮怪!</h1>
            <button class="Shine">Hover Me</button>
            <button class="Shine last">Hover Me!!</button>
        </center>
    </body>
</html>

css

.Shine {
  background: #3e5771;
  color: white;
  border: none;
  padding: 16px 36px;
  font-weight: normal;
  border-radius: 3px;
  transition: all 0.25s ease;
  box-shadow: 0 38px 32px -23px black;
  margin: 0 1em 1em;
}
.Shine:hover {
  background: #2c3e50;
  color: rgba(255, 255, 255, 0.2);
}

Js

/*
        Author:352183987@qq.com
        Time:2018-01-09
        Des:群星环绕
        LastModify:2018年1月9日11:17:01
 */
$(function() {

  // 默认是不同程度的透明白色闪烁
  $(".Shine:first").sparkleh();

  // rainbow用来产生随机颜色
  // count决定闪闪发光的数量
  // overlap决定闪烁点的移动,不过要小心其他的dom事件.
  $(".Shine:last").sparkleh({
    color: "rainbow",
    count: 100,
    overlap: 10
  });

  // 在这里创建了Fuscia闪烁
  $("h1").sparkleh({
    count: 80,
    color: "#ff0080"
  });

  $("p").sparkleh({
    count: 20,
    color: "#00ff00"
  });

  // color也可以是数组
  // 对于image,需要完全加载才能设置
  // canvas的高度或者宽度 
  $("#image").imagesLoaded( function() {
    $(".img").sparkleh({
      count: 25,
      color: ["#00afec","#fb6f4a","#fdfec5"]
    });
  });

});

$.fn.sparkleh = function( options ) {

  return this.each( function(k,v) {

    var $this = $(v).css("position","relative");

    var settings = $.extend({
      width: $this.outerWidth(),
      height: $this.outerHeight(),
      color: "#FFFFFF",
      count: 30,
      overlap: 0
    }, options );

    var sparkle = new Sparkle( $this, settings );

    $this.on({
      "mouseover focus" : function(e) {
        sparkle.over();
      },
      "mouseout blur" : function(e) {
        sparkle.out();
      }
    });

  });

}

function Sparkle( $parent, options ) {
  this.options = options;
  this.init( $parent );
}

Sparkle.prototype = {

  "init" : function( $parent ) {

    var _this = this;

    this.$canvas = 
      $("<canvas>")
        .addClass("sparkle-canvas")
        .css({
          position: "absolute",
          top: "-"+_this.options.overlap+"px",
          left: "-"+_this.options.overlap+"px",
          "pointer-events": "none"
        })
        .appendTo($parent);

    this.canvas = this.$canvas[0];
    this.context = this.canvas.getContext("2d");
    this.sprite = new Image();

    this.canvas.width = this.options.width + ( this.options.overlap * 2);
    this.canvas.height = this.options.height + ( this.options.overlap * 2);

    this.sprites = [0,6,13,20];
    this.particles = this.createSparkles( this.canvas.width , this.canvas.height );

    this.anim = null;
    this.fade = false;

  },

  "createSparkles" : function( w , h ) {

    var holder = [];

    for( var i = 0; i < this.options.count; i++ ) {

      var color = this.options.color;

      if( this.options.color == "rainbow" ) {
        color = '#'+Math.floor(Math.random()*16777215).toString(16);
      } else if( $.type(this.options.color) === "array" ) {
        color = this.options.color[ Math.floor(Math.random()*this.options.color.length) ];
      }

      holder[i] = {
        position: {
          x: Math.floor(Math.random()*w),
          y: Math.floor(Math.random()*h)
        },
        style: this.sprites[ Math.floor(Math.random()*4) ],
        delta: {
          x: Math.floor(Math.random() * 1000) - 500,
          y: Math.floor(Math.random() * 1000) - 500
        },
        size: parseFloat((Math.random()*2).toFixed(2)),
        color: color
      };

    }

    return holder;

  },

  "draw" : function( time, fade ) {

    var ctx = this.context;
    var img = this.sprite;
        img.src = this.datauri;

    ctx.clearRect( 0, 0, this.canvas.width, this.canvas.height );

    for( var i = 0; i < this.options.count; i++ ) {

      var derpicle = this.particles[i];
      var modulus = Math.floor(Math.random()*7);

      if( Math.floor(time) % modulus === 0 ) {
        derpicle.style = this.sprites[ Math.floor(Math.random()*4) ];
      }

      ctx.save();
      ctx.globalAlpha = derpicle.opacity;
      ctx.drawImage(img, derpicle.style, 0, 7, 7, derpicle.position.x, derpicle.position.y, 7, 7);

      if( this.options.color ) {  

        ctx.globalCompositeOperation = "source-atop";
        ctx.globalAlpha = 0.5;
        ctx.fillStyle = derpicle.color;
        ctx.fillRect(derpicle.position.x, derpicle.position.y, 7, 7);

      }

      ctx.restore();

    }

  },

  "update" : function() {

     var _this = this;

     this.anim = window.requestAnimationFrame( function(time) {

       for( var i = 0; i < _this.options.count; i++ ) {

         var u = _this.particles[i];

         var randX = ( Math.random() > Math.random()*2 );
         var randY = ( Math.random() > Math.random()*3 );

         if( randX ) {
           u.position.x += (u.delta.x / 1500); 
         }        

         if( !randY ) {
           u.position.y -= (u.delta.y / 800);         
         }

         if( u.position.x > _this.canvas.width ) {
           u.position.x = -7;
         } else if ( u.position.x < -7 ) {
           u.position.x = _this.canvas.width; 
         }

         if( u.position.y > _this.canvas.height ) {
           u.position.y = -7;
           u.position.x = Math.floor(Math.random()*_this.canvas.width);
         } else if ( u.position.y < -7 ) {
           u.position.y = _this.canvas.height; 
           u.position.x = Math.floor(Math.random()*_this.canvas.width);
         }

         if( _this.fade ) {
           u.opacity -= 0.02;
         } else {
           u.opacity -= 0.005;
         }

         if( u.opacity <= 0 ) {
           u.opacity = ( _this.fade ) ? 0 : 1;
         }

       }

       _this.draw( time );

       if( _this.fade ) {
         _this.fadeCount -= 1;
         if( _this.fadeCount < 0 ) {
           window.cancelAnimationFrame( _this.anim );
         } else {
           _this.update(); 
         }
       } else {
         _this.update();
       }

     });

  },

  "cancel" : function() {

    this.fadeCount = 100;

  },

  "over" : function() {

    window.cancelAnimationFrame( this.anim );

    for( var i = 0; i < this.options.count; i++ ) {
      this.particles[i].opacity = Math.random();
    }

    this.fade = false;
    this.update();

  },

  "out" : function() {

    this.fade = true;
    this.cancel();

  },

  "datauri" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAHCAYAAAD5wDa1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozNDNFMzM5REEyMkUxMUUzOEE3NEI3Q0U1QUIzMTc4NiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozNDNFMzM5RUEyMkUxMUUzOEE3NEI3Q0U1QUIzMTc4NiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjM0M0UzMzlCQTIyRTExRTM4QTc0QjdDRTVBQjMxNzg2IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM0M0UzMzlDQTIyRTExRTM4QTc0QjdDRTVBQjMxNzg2Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+jzOsUQAAANhJREFUeNqsks0KhCAUhW/Sz6pFSc1AD9HL+OBFbdsVOKWLajH9EE7GFBEjOMxcUNHD8dxPBCEE/DKyLGMqraoqcd4j0ChpUmlBEGCFRBzH2dbj5JycJAn90CEpy1J2SK4apVSM4yiKonhePYwxMU2TaJrm8BpykpWmKQ3D8FbX9SOO4/tOhDEG0zRhGAZo2xaiKDLyPGeSyPM8sCxr868+WC/mvu9j13XBtm1ACME8z7AsC/R9r0fGOf+arOu6jUwS7l6tT/B+xo+aDFRo5BykHfav3/gSYAAtIdQ1IT0puAAAAABJRU5ErkJggg=="

}; 

// $('img.photo',this).imagesLoaded(myFunction)
// 因为.load()不适用于缓存的图像,所以所有图像加载完成后执行回调.

// 回调函数传递最后一个图像作为参数加载,集合为`this`

$.fn.imagesLoaded = function(callback){
  var elems = this.filter('img'),
      len   = elems.length,
      blank = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";

  elems.bind('load.imgloaded',function(){
      if (--len <= 0 && this.src !== blank){ 
        elems.unbind('load.imgloaded');
        callback.call(elems,this); 
      }
  }).each(function(){
     // 缓存的图像有时不会触发负载,所以我们重置src.
     if (this.complete || this.complete === undefined){
        var src = this.src;
        this.src = blank;
        this.src = src;
     }  
  }); 

  return this;
};

雪花飘落

这里写图片描述

html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>雪花飘落</title>
        <link rel="apple-touch-icon" href="images/apple-touch-icon.png" />
        <!-- The leaves.css file animates the leaves -->
        <link rel="stylesheet" href="css/SnowFall.css" type="text/css" media="screen" charset="utf-8">
        <!-- The leaves.js file creates the leaves -->
        <script src="js/SnowFall.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
        <!--
            作者:352183987@qq.com
            时间:2018-01-09
            描述:雪花飘落
        -->
        <div id="container">
            <!-- The container is dynamically populated using the init function in leaves.js -->
            <!-- Its dimensions and position are defined using its id selector in leaves.css -->
            <div id="leafContainer"></div>
            <!-- its appearance, dimensions, and position are defined using its id selector in leaves.css -->
        </div>
    </body>
</html>

css

/*
        Author:352183987@qq.com
        Time:2018-01-09
        Des:雪花飘落
        LastModify: 2018年1月9日12:07:03
 */

body
{
    background-color: #fff;
}

#container {
    position: relative;
    height: 90vh;
    width: 90vw;
    margin: 10px auto;
    overflow: hidden;
    border: 4px solid #ccc;
}

/* Defines the position and dimensions of the leafContainer div */
#leafContainer 
{
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Sets the color of the "Dino's Gardening Service" message */
em 
{
    font-weight: bold;
    font-style: normal;
}

/* This CSS rule is applied to all div elements in the leafContainer div.
   It styles and animates each leafDiv.
*/
#leafContainer > div 
{
    position: absolute;
    width: 100px;
    height: 100px;

    /* We use the following properties to apply the fade and drop animations to each leaf.
       Each of these properties takes two values. These values respectively match a setting
       for fade and drop.
    */
    -webkit-animation-iteration-count: infinite, infinite;
    -webkit-animation-direction: normal, normal;
    -webkit-animation-timing-function: linear, ease-in;
}

/* This CSS rule is applied to all img elements directly inside div elements which are
   directly inside the leafContainer div. In other words, it matches the 'img' elements
   inside the leafDivs which are created in the createALeaf() function.
*/
#leafContainer > div > img {
     position: absolute;
     width: 50px;
     height: 50px;

    /* We use the following properties to adjust the clockwiseSpin or counterclockwiseSpinAndFlip
       animations on each leaf.
       The createALeaf function in the Leaves.js file determines whether a leaf has the 
       clockwiseSpin or counterclockwiseSpinAndFlip animation.
    */
     -webkit-animation-iteration-count: infinite;
     -webkit-animation-direction: alternate;
     -webkit-animation-timing-function: ease-in-out;
     -webkit-transform-origin: 50% -100%;
}


/* Hides a leaf towards the very end of the animation */
@-webkit-keyframes fade
{
    /* Show a leaf while into or below 95 percent of the animation and hide it, otherwise */
    0%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { opacity: 0; }
}


/* Makes a leaf fall from -300 to 600 pixels in the y-axis */
@-webkit-keyframes drop
{
    /* Move a leaf to -300 pixels in the y-axis at the start of the animation */
    0%   { -webkit-transform: translate(0px, -50px); }
    /* Move a leaf to 600 pixels in the y-axis at the end of the animation */
    100% { -webkit-transform: translate(0px, 850px); }
}

/* Rotates a leaf from -50 to 50 degrees in 2D space */
@-webkit-keyframes clockwiseSpin
{
    /* Rotate a leaf by -50 degrees in 2D space at the start of the animation */
    0%   { -webkit-transform: rotate(-50deg); }
    /*  Rotate a leaf by 50 degrees in 2D space at the end of the animation */
    100% { -webkit-transform: rotate(50deg); }
}


/* Flips a leaf and rotates it from 50 to -50 degrees in 2D space */
@-webkit-keyframes counterclockwiseSpinAndFlip 
{
    /* Flip a leaf and rotate it by 50 degrees in 2D space at the start of the animation */
    0%   { -webkit-transform: scale(-1, 1) rotate(50deg); }
    /* Flip a leaf and rotate it by -50 degrees in 2D space at the end of the animation */
    100% { -webkit-transform: scale(-1, 1) rotate(-50deg); }
}

Js

/*
        Author:352183987@qq.com
        Time:2018-01-09
        Des:雪花飘落
        LastModify: 2018年1月9日12:07:03
 */

const NUMBER_OF_LEAVES = 60;
/* 
    Called when the "Falling Leaves" page is completely loaded.
*/
function init()
{
    /* Get a reference to the element that will contain the leaves */
    var container = document.getElementById('leafContainer');
    /* Fill the empty container with new leaves */
    for (var i = 0; i < NUMBER_OF_LEAVES; i++) 
    {
        container.appendChild(createALeaf());
    }
}
/*
    Receives the lowest and highest values of a range and
    returns a random integer that falls within that range.
*/
function randomInteger(low, high)
{
    return low + Math.floor(Math.random() * (high - low));
}
/*
   Receives the lowest and highest values of a range and
   returns a random float that falls within that range.
*/
function randomFloat(low, high)
{
    return low + Math.random() * (high - low);
}


/*
    Receives a number and returns its CSS pixel value.
*/
function pixelValue(value)
{
    return value + 'vw';
}


/*
    Returns a duration value for the falling animation.
*/

function durationValue(value)
{
    return value + 's';
}


/*
    Uses an img element to create each leaf. "Leaves.css" implements two spin 
    animations for the leaves: clockwiseSpin and counterclockwiseSpinAndFlip. This
    function determines which of these spin animations should be applied to each leaf.

*/
function createALeaf()
{
    /* Start by creating a wrapper div, and an empty img element */
    var leafDiv = document.createElement('div');
    var image = document.createElement('img');

    /* Randomly choose a leaf image and assign it to the newly created element */
    //image.src = 'images/realLeaf' + randomInteger(1, 5) + '.png';
    image.src = 'img/Snow.png';

    leafDiv.style.top = "-50px";

    /* Position the leaf at a random location along the screen */
    leafDiv.style.left = pixelValue(randomInteger(0, 90));

    /* Randomly choose a spin animation */
    var spinAnimationName = (Math.random() < 0.5) ? 'clockwiseSpin' : 'counterclockwiseSpinAndFlip';

    /* Set the -webkit-animation-name property with these values */
    leafDiv.style.webkitAnimationName = 'fade, drop';
    image.style.webkitAnimationName = spinAnimationName;

    /* Figure out a random duration for the fade and drop animations */
    var fadeAndDropDuration = durationValue(randomFloat(5, 11));

    /* Figure out another random duration for the spin animation */
    var spinDuration = durationValue(randomFloat(4, 8));
    /* Set the -webkit-animation-duration property with these values */
    leafDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + fadeAndDropDuration;

    var leafDelay = durationValue(randomFloat(0, 5));
    leafDiv.style.webkitAnimationDelay = leafDelay + ', ' + leafDelay;

    image.style.webkitAnimationDuration = spinDuration;

    // add the <img> to the <div>
    leafDiv.appendChild(image);

    /* Return this img element so it can be added to the document */
    return leafDiv;
}


/* Calls the init function when the "Falling Leaves" page is full loaded */
window.addEventListener('load', init, false);

闪耀按钮

闪耀按钮

html

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>闪光按钮</title>
        <link rel="stylesheet" href="css/ShineBtn.css" />
    </head>
    <body id="radioactiveButtonsPage" class="chrome windows">
        <div class="wall-of-buttons">
            <a class="large green button">路飞</a>
            <a class="large blue button">黑崎一护</a>
            <a class="large magenta button">白胡子</a>
            <a class="large green button">朽木露琪亚</a>
            <a class="large red button">蓝染</a>
            <a class="large magenta button">井上织姬</a>
            <br />

            <a class="large orange button">野比大雄</a>
            <a class="large magenta button">刚田武胖虎</a>
            <a class="large green button">骨川小夫</a>
            <a class="large orangellow button">源静香</a>
            <a class="large blue button">哆啦A梦</a>
            <a class="large red button">夏目友人帐</a>
            <a class="large blue button">娘口三三</a>
            <br />

            <a class="large magenta button">坂本</a>
            <a class="large orangellow button">出木杉</a>
            <a class="large red button">哆啦小子</a>
            <a class="large orange button">哆啦王</a>
            <a class="large green button">哆啦尼可夫</a>
            <a class="large orangellow button">哆啦利钮</a>
            <a class="large red button">哆啦梅度三世</a>

            <a class="large blue button">耶鲁马他哆啦</a>
            <a class="large orangellow button">御坂美琴</a>
            <a class="large blue button">利威尔·阿克曼</a>
            <a class="large red button">叶音竹</a>
            <a class="large orange button">萧炎</a>
            <a class="large orangellow button">美少女战士</a>
        </div>
    </body>

</html>

Css


body {
                background: #333;
                text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
            }

            @-webkit-keyframes bigAssButtonPulse {
                from {
                    background-color: #749a02;
                    -webkit-box-shadow: 0 0 25px #333;
                }
                50% {
                    background-color: #91bd09;
                    -webkit-box-shadow: 0 0 50px #91bd09;
                }
                to {
                    background-color: #749a02;
                    -webkit-box-shadow: 0 0 25px #333;
                }
            }

            @-webkit-keyframes greenPulse {
                from {
                    background-color: #749a02;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #91bd09;
                    -webkit-box-shadow: 0 0 18px #91bd09;
                }
                to {
                    background-color: #749a02;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            @-webkit-keyframes bluePulse {
                from {
                    background-color: #007d9a;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #2daebf;
                    -webkit-box-shadow: 0 0 18px #2daebf;
                }
                to {
                    background-color: #007d9a;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            @-webkit-keyframes redPulse {
                from {
                    background-color: #bc330d;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #e33100;
                    -webkit-box-shadow: 0 0 18px #e33100;
                }
                to {
                    background-color: #bc330d;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            @-webkit-keyframes magentaPulse {
                from {
                    background-color: #630030;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #a9014b;
                    -webkit-box-shadow: 0 0 18px #a9014b;
                }
                to {
                    background-color: #630030;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            @-webkit-keyframes orangePulse {
                from {
                    background-color: #d45500;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #ff5c00;
                    -webkit-box-shadow: 0 0 18px #ff5c00;
                }
                to {
                    background-color: #d45500;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            @-webkit-keyframes orangellowPulse {
                from {
                    background-color: #fc9200;
                    -webkit-box-shadow: 0 0 9px #333;
                }
                50% {
                    background-color: #ffb515;
                    -webkit-box-shadow: 0 0 18px #ffb515;
                }
                to {
                    background-color: #fc9200;
                    -webkit-box-shadow: 0 0 9px #333;
                }
            }

            a.button {
                -webkit-animation-duration: 2s;
                -webkit-animation-iteration-count: infinite;
            }

            .green.button {
                -webkit-animation-name: greenPulse;
                -webkit-animation-duration: 3s;
            }

            .blue.button {
                -webkit-animation-name: bluePulse;
                -webkit-animation-duration: 4s;
            }

            .red.button {
                -webkit-animation-name: redPulse;
                -webkit-animation-duration: 1s;
            }

            .magenta.button {
                -webkit-animation-name: magentaPulse;
                -webkit-animation-duration: 2s;
            }

            .orange.button {
                -webkit-animation-name: orangePulse;
                -webkit-animation-duration: 3s;
            }

            .orangellow.button {
                -webkit-animation-name: orangellowPulse;
                -webkit-animation-duration: 5s;
            }

            .wall-of-buttons {
                width: 100%;
                height: 180px;
                text-align: center;
            }

            .wall-of-buttons a.button {
                display: inline-block;
                margin: 0 10px 9px 0;
            }

.button {
    display: inline-block;
    padding: 5px 15px 6px;
    color: #fff !important;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    text-decoration: none;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    position: relative;
    cursor: pointer;
    overflow: visible;
    width: auto;
}

button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

.button:hover {
    background-color: #111;
    color: #fff;
}

.button:active {
    -webkit-transform: translateY(1px);
    -moz-transform: translateY(1px);
}


/* Small Buttons */

.small.button {
    font-size: 11px;
}


/* Large Buttons */

.large.button {
    font-size: 14px;
    padding: 8px 19px 9px;
}


/* Colors for our beloved buttons */

.green.button {
    background-color: #91bd09;
}

.green.button:hover {
    background-color: #749a02;
}

.blue.button {
    background-color: #2daebf;
}

.blue.button:hover {
    background-color: #007d9a;
}

.red.button {
    background-color: #e33100;
}

.red.button:hover {
    background-color: #872300;
}

.magenta.button {
    background-color: #a9014b;
}

.magenta.button:hover {
    background-color: #630030;
}

.orange.button {
    background-color: #ff5c00;
}

.orange.button:hover {
    background-color: #d45500;
}

.orangellow.button {
    background-color: #ffb515;
}

.orangellow.button:hover {
    background-color: #fc9200;
}

.white.button {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #666 !important;
    font-weight: normal;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 1);
}

.white.button:hover {
    background-color: #eee;
}


/*Strike button*/

.strike.button {
    background-color: #4ADFC1
}

.strike.button:hover {
    background-color: #39ceb0
}


/* Secondary buttons (perfect for Cancels or other secondary actions */

.secondary.button {
    background: #fff url(/images/gradients/36px-black.png) repeat-x 0 0;
    color: #555 !important;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    border: 1px solid #bbb;
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.secondary.button:hover {
    background-color: #eee;
    color: #444 !important;
    border-color: #999;
}


/* Make the buttons super awesomer */

.super.button {
    background-image: url(/images/super-button-overlay.png);
    font-size: 13px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .25);
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
}

.super.button span {
    display: block;
    padding: 4px 15px 6px;
    -webkit-border-radius: 14px;
    -moz-border-radius: 14px;
    border-top: 1px solid rgba(255, 255, 255, .2);
    line-height: 1;
}

.small.super.button {
    font-size: 11px;
    -webkit-border-radius: 12px;
    -moz-border-radius: 12px;
}

.small.super.button span {
    padding: 2px 12px 6px;
    -webkit-border-radius: 11px;
    -moz-border-radius: 11px;
}

.small.white.super.button span {
    padding: 3px 12px 5px;
}

.large.super.button {
    background-position: left bottom;
    -webkit-border-radius: 18px;
    -moz-border-radius: 18px;
}

.large.super.button span {
    font-size: 14px;
    padding: 7px 20px 9px;
    -webkit-border-radius: 17px;
    -moz-border-radius: 17px;
}

抽卡

抽卡

(PS: 想要背景大图的加Q: 352183987)

html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>抽卡</title>
        <link rel="stylesheet" href="css/card.css" />
        <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
    </head>
    <body>
        <div class="container">
            <div class="folder">
                <div class="paper">
                    <h1>なつめ ゆうじん ちょう</h1>
                    <p>我想成为一个温柔的人,因为曾被温柔的人那样对待,深深了解那种被温柔相待的感觉.</p>
                    <p>所看到的东西未必存在,没有人理解我独自行走在那个不安定世界的恐惧。所看到的东西或许也不存在,那个不安定的世界.</p>
                    <p>我喜欢温柔,也喜欢温暖,所以我喜欢人类.</p>
                </div>
                <div class="cover">
                    <div class="title">夏目友人帐</div>
                </div>
            </div>
        </div>

    </body>
</html>

Css

/*
    Author:352183987@qq.com
    Time:2018-01-09
    Des:抽卡
    LastModify: 2018年1月9日16:00:17
 */
*, *:before, *:after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: url(../img/XM.jpg);
  margin: 0;
  padding: 0;
}

.container {
  position: relative;
  width: 100%;
  height: 100%;
}
.container > .folder {
  width: 220px;
  height: 180px;
  left: calc(50% - 110px);
  top: calc(70% - 90px);
  position: absolute;
}
.container > .folder > .cover {
  cursor: pointer;
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #fab62f;
  -moz-border-radius: 0 0 10px 10px;
  -webkit-border-radius: 0;
  border-radius: 0 0 10px 10px;
  -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.2);
  box-shadow: 5px 5px rgba(0, 0, 0, 0.2);
}
.container > .folder > .cover:before, .container > .folder > .cover:after {
  box-sizing: border-box;
  content: "";
  display: block;
  position: absolute;
  top: -100px;
  border: 50px solid transparent;
}
.container > .folder > .cover:before {
  left: 0;
  width: 50%;
  border-left: none;
  border-bottom-color: #fab62f;
}
.container > .folder > .cover:after {
  right: 0;
  width: 50%;
  border-right: none;
  border-bottom-color: #fab62f;
}
.container > .folder > .cover > .title {
  position: absolute;
  padding: 1em;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  font-weight: bold;
  text-align: center;
  font-size: 2.5em;
  color: rgba(0, 0, 0, 0.1);
  -moz-user-select: -moz-none;
  -ms-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  -moz-transform: rotate(20deg);
  -ms-transform: rotate(20deg);
  -o-transform: rotate(20deg);
  -webkit-transform: rotate(20deg);
  transform: rotate(20deg);
}
.container > .folder > .paper {
  opacity: 1;
  position: absolute;
  overflow: hidden;
  width: 200px;
  height: 200px;
  top: calc(50% - 150px);
  left: calc(50% - 100px);
  transition: top 0.5s, opacity 0.4s;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 0.1em;
  padding: 1em;
  color: #644812;
  background-color: #fde1ab;
  -moz-box-shadow: 10px 10px rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: 10px 10px rgba(0, 0, 0, 0.2);
  box-shadow: 10px 10px rgba(0, 0, 0, 0.2);
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
}
.container > .folder:hover > .paper {
  top: calc(50% - 200px);
}
.container > .folder.opened > .paper {
  top: calc(-500px);
  opacity: 0;
}

Js

$(document).on('click', '.folder', function() {
    $(this).toggleClass('opened');
});
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Embedded Coder针对AUTOSAR(AUTomotive Open System Architecture)标准提供了支持包。AUTOSAR是用于汽车电子系统开发的开放标准。通过Embedded Coder的支持包,开发人员可以更方便地使用MATLAB和Simulink进行AUTOSAR应用程序的开发和验证。 Embedded Coder支持包为AUTOSAR提供了自动生成和自动配置AUTOSAR软件组件的功能,无需手动编写或配置大量的代码。使用Embedded Coder,开发人员可以通过MATLAB和Simulink的图形化界面来设计和测试AUTOSAR应用程序,并自动生成与AUTOSAR标准兼容的C代码。 Embedded Coder的支持包还提供了AUTOSAR的元模型,该模型包含AUTOSAR标准的核心构造块,如软件组件、服务接口、端到端连线等。开发人员可以在MATLAB和Simulink中使用这些元模型,以及AUTOSAR建模工具箱,快速构建AUTOSAR应用程序。 此外,Embedded Coder的支持包还包括AUTOSAR的约束和规格管理工具。开发人员可以使用这些工具来验证代码是否遵循AUTOSAR标准,并自动生成符合标准的文档和报告。 综上所述,Embedded Coder的支持包为AUTOSAR标准提供了强大的开发和验证工具,帮助开发人员更高效地设计和实现AUTOSAR应用程序,并加快产品开发周期,提高软件质量。 ### 回答2: 嵌入式编码器支持包(Embedded Coder Support Package)用于AUTOSAR标准。AUTOSAR(Automotive Open System Architecture)是用于汽车电子系统的开放式软件架构标准。该标准旨在加强汽车电子系统的可重用性、可扩展性和互操作性。 嵌入式编码器支持包是MATLAB和Simulink的一个功能扩展,用于与AUTOSAR标准进行集成。该支持包提供了一系列工具和功能,使开发人员能够创建符合AUTOSAR标准的嵌入式代码。 使用嵌入式编码器支持包,开发人员可以从Simulink模型自动生成AUTOSAR标准的C代码。该支持包具有与AUTOSAR标准相一致的架构和命名约定,包括AUTOSAR的软件组件、接口、端口和信号等概念。 嵌入式编码器支持包还提供了与AUTOSAR工具链进行交互的功能。开发人员可以使用该支持包将生成的C代码与AUTOSAR工具链中的其他软件组件进行集成和验证。这种集成可以通过AUTOSAR内容描述文件(ARXML文件)来实现,ARXML文件描述了AUTOSAR系统架构的各个方面。 通过嵌入式编码器支持包,开发人员可以更加高效地开发和部署AUTOSAR标准的嵌入式系统。他们可以在Simulink环境中使用高级建模和仿真功能,然后使用嵌入式编码器支持包将模型转换为可部署的C代码,从而减少了手动编码的工作量和错误的机会。 总之,嵌入式编码器支持包为AUTOSAR标准提供了一种高效的开发方法,同时提供了与AUTOSAR工具链的集成能力,使开发人员能够更轻松地创建和部署符合AUTOSAR标准的嵌入式系统。 ### 回答3: Embedded Coder Support Package for AUTOSAR Standard(AUTOSAR标准的嵌入式编码器支持包)是MathWorks开发的一种用于AUTOSAR(Automotive Open System Architecture)标准的软件工具包。AUTOSAR是一个用于开发汽车软件的全球行业标准,旨在提高汽车软件开发的效率和可重复性。 嵌入式编码器支持包为使用MathWorks的MATLAB和Simulink工具进行AUTOSAR软件开发提供了便利。它包含了与AUTOSAR标准兼容的构建块、代码生成器以及与AUTOSAR软件架构约束相匹配的自动代码生成规则。此支持包还提供了与AUTOSAR标准相关的模型检查器、验证工具和生成的代码的静态分析。 使用嵌入式编码器支持包,开发人员可以通过MATLAB和Simulink的模型驱动开发方法快速建模和设计AUTOSAR系统。开发人员可以使用自动生成的AUTOSAR代码直接部署到AUTOSAR平台上,提高开发效率并降低错误率。 此外,嵌入式编码器支持包还提供了用于自动配置AUTOSAR软件组件和服务的工具。它通过与AUTOSAR的构建工具链和开发环境紧密集成,从而帮助开发人员更好地集成和部署AUTOSAR系统。 总而言之,嵌入式编码器支持包是一种用于AUTOSAR标准的软件工具包,它提供了MATLAB和Simulink的功能,用于在AUTOSAR架构下进行快速、高效的软件开发。通过使用这个支持包,开发人员可以更好地遵循AUTOSAR标准,并减少开发时间和错误率,从而提高最终软件的质量和可靠性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值