css布局实现移动端手机端弹出红包奖励效果代码

代码语言:html

所属分类:布局界面

代码描述:css布局实现移动端手机端弹出红包奖励效果代码

代码标签: 移动 手机 弹出 红包 奖励 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>红包</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/mathlib-min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/k3d-min.js"></script>
    <script >
// 监听页面加载处理
window.addEventListener('load', onloadHandler, false);


// 页面加载处理

function onloadHandler()
{
   var canvas = document.getElementById('canvas');
   canvas.width = window.innerWidth;
   canvas.height = window.innerHeight;
   var k3dmain = new K3D.Controller(canvas, true);

   // 添加页面渲染循环回调函数
   var ctx = canvas.getContext('2d');
   var rotationOffset = 0;
   var len = (canvas.height > canvas.width ? canvas.height : canvas.width) * 0.7;
   k3dmain.clearBackground = false;
   k3dmain.callback = function()
   {
      // 清除画布
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      
      // 绘制3d效果
      ctx.save();
      ctx.translate(canvas.width/2, canvas.height/2);
      ctx.rotate(rotationOffset);
      
      // 绘制辐射条
      var RAYCOUNT = 24;
      ctx.fillStyle = "#fdd971";
      ctx.beginPath();
      for (var i=0; i<RAYCOUNT; i++)
      {
         ctx.rotate(TWOPI / RAYCOUNT);
         ctx.moveTo(0, 0);
         ctx.lineTo(-20, len);
         ctx.lineTo(20, len);
      }
      ctx.closePath();
      ctx.fill();
      ctx.fillStyle = "#fdd971";//设置辐射条颜色
      ctx.beginPath();
      for (var i=0; i<RAYCOUNT; i++)
      {
         // 辐射条坐标
         ctx.rotate(TWOPI / RAYCOUNT);
         ctx.moveTo(0, 0);
         ctx.lineTo(-15, len);
         ctx.lineTo(15, len);
      }
      ctx.closePath();
      ctx.fill();
      ctx.restore();
      rotationOffset += 0.005;
      
      // 转动辐射条
      for (var i=0, objs=k3dmain.objects; i<objs.length; i++)
{
   objs[i].ophi += targetRotationX;
}

   if (targetRotationX > -0.5) targetRotationX -= 0.05;
   else if (targetRotationX < -0.55) targetRotationX += 0.05;
   if (targetRotationX > -0.55 && targetRotationX < -0.5) targetRotationX = -0.5;
};

   // 循环转动
   k3dmain.paused = true;
   setInterval(function(){k3dmain.tick()}, 1000/60);
}
var targetRotationX = 0;</script>
<style>

*{    margin: 0;
	padding: 0;
	box-sizing: border-box;
}
canvas{
	display: inline-block;
	vertical-align: baseline;
}
html{
	color: #fff;
	font-size: 14px;
}
.container{
	text-align: center;
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 15px 5px;
	background-color: rgba(0,0,0,0);
	height: 100%;
	position: absolute;
	z-index: 1;
	top: 0;
	-webkit-transform: scale(1);
	transform: scale(1);
	opacity: 0;
	-webkit-animation: fromBack 1s linear forwards;
	animation: fromBack 1s linear forwards;
}
@-webkit-keyframes fromBack{
	0%{
		transform: scale(0);
		opacity: 0;
	}
	100%{
		transform: scale(1);
		opacity: 1;
	}
}
@keyframes fromBack{
	0%{
		transform: scale(0);
		opacity: 0;
	}
	100%{
		transform: scale(1);
		opacity: 1;
	}
}
.RedBox{

	height: 450px;
	background-color: #ff605e;
	width: 300px;
	left: 0;
	top: 0;
	border-radius: 10px;
	margin: 100px auto;
	border-radius: 50% 50% 10px 10px / 15% 15% 10px 10px;
	box-shadow: inset 0 4px 0 -1px rgba(0,0,0,0.2);

}
.topcontent{
	height: 280px;
	background-image: url("//repo.bfw.wiki/bfwrepo/image/60dd6e6630339.png");
	-webkit-background-size: contain;
	background-size: contain;
	background-repeat: no-repeat;

}
.avatar{
	position: relative;
}
.topcontent img{
	border: 1px solid #BD503A;
	border-radius: 50%;
	overflow: hidden;
	margin-top: 15%;
	-webkit-animation-duration: 5s;
	animation-duration: 5s;

}
.topcontent h2{
	margin: 5px 0;
	padding-top: 100px;
	color: #fed261;
	-webkit-animation-duration: 3s;
	animation-duration: 3s;
}
.text{
	color: #ff605e;;
	font-weight: bold;
	font-size: 1.5rem;
	-webkit-animation-duration: 4s;
	animation-duration: 4s;
}
.text b{
	font-size: 2rem;

}
.description1{
	margin: 40px 50px;
	font-size: 16px;
	font-weight: 600;
	height: 34px;
	background: #fff;
	color:#ff605e;
	line-height: 34px;
	border-radius: 5px;
	-webkit-animation-duration: 4s;
	animation-duration: 4s;
}
.description2{
	margin: 10px 50px;
	font-size: 16px;
	font-weight: 600;

}

.rotate{
	-webkit-animation: anim .6s infinite alternate;
		-ms-animation: anim .6s infinite alternate;
			animation: anim .6s infinite alternate;
}
@-webkit-keyframes anim {
	from { -webkit-transform: rotateY(180deg); }
	to { -webkit-transform: rotateY(360deg); }
}
@-ms-keyframes anim {
	from { -ms-transform: rotateY(180deg); }
	to { -ms-transform: rotateY(360deg); }
}
@keyframes anim {
	from { transform: rotateY(180deg); }
	to { transform: rotateY(360deg); }
}

@-webkit-keyframes bounceInDown {
	from, 60%, 75%, 90%, to {
		-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
		animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
	}

	0% {
		opacity: 0;
		-webkit-transform: translate3d(0, -3000px, 0);
		transform: translate3d(0, -3000px, 0);
	}

	60% {.........完整代码请登录后点击上方下载按钮下载查看

网友评论0