基于HTML5 CSS3实现奥运五环特效



8 28 10



特效描述:基于HTML5 CSS3实现 奥运五环特效,基于HTML5 CSS3实现奥运五环特效

代码结构

1. HTML代码

<div class="snow"></div>
<div class="snow"></div>
<div class="snow"></div>
<div class="rings">
  <div class="ring ring--blue"></div>
  <div class="ring ring--yellow"></div>
  <div class="ring ring--blue ring-segment"></div>
  <div class="ring ring--black ring-segment"></div>
  <div class="ring ring--black"></div>
  <div class="ring ring--green"></div>
  <div class="ring ring--green ring-segment"></div>
  <div class="ring ring--red"></div>
  <div class="ring ring--red ring-segment"></div>
</div>
<script type="text/javascript">
var generateCanvasImageUrl = function generateCanvasImageUrl() {
  var _window = window,
      innerHeight = _window.innerHeight,
      innerWidth = _window.innerWidth;
  var pixels = innerHeight / 1 * (innerWidth / 1);
  var $canvas = document.createElement('canvas');
  var context = $canvas.getContext('2d');
  $canvas.height = innerHeight / 1;
  $canvas.width = innerWidth / 1;
  for (var pixel = 0; pixel < pixels; pixel++) {
    var x = pixel % innerWidth;
    var y = Math.floor(pixel / innerWidth);
    var size = Math.floor(Math.random() * 3 + 1);
    context.fillStyle = '#fff';
    if (Math.random() > 0.9999) context.fillRect(x, y, size, size);
  }
  return $canvas.toDataURL();
};
var $snowSlides = document.querySelectorAll('.snow');
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
  for (var _iterator = $snowSlides[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
    var $slide = _step.value;
    $slide.style.background = 'url(' + generateCanvasImageUrl() + ')';
  }
} catch (err) {
  _didIteratorError = true;
  _iteratorError = err;
} finally {
  try {
    if (!_iteratorNormalCompletion && _iterator.return) {
      _iterator.return();
    }
  } finally {
    if (_didIteratorError) {
      throw _iteratorError;
    }
  }
}
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 加载动画 h5弹窗动画 html5弹窗动画 h5动画 h5背景动画 h5场景动画 h53D动画 h5界面动画 html5动画 h5按钮动画 html5按钮动画 h5图片动画 h5图标动画 html5图片动画 html5图标动画

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到