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; backgroun.........完整代码请登录后点击上方下载按钮下载查看
网友评论0