大佬教程收集整理的这篇文章主要介绍了html5 animate for game,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
最近做的活动页面,记录下:
负责了两块的活动效果:翻牌和开宝箱;@H_607_6@
父级元素设置3D视角:@H_607_6@
-webkit-perspective: 1000; perspective: 1000;
CSS @keyframes 规定动画(各种浏览器记得加前缀):@H_607_6@
@keyframes flipintoleft { from { transform: rotateY(-90deg) scale(.9); } to { transform: rotateY(0); } }
使用:@H_607_6@
.flip { -webkit-BACkface-visibility: hidden; -webkit-transform: translateX(0); /* Needed to work around an iOS 3.1 bug that causes listview thumbs to disappear when -webkit-visibility:hidden is used. */ BACkface-visibility: hidden; transform: translateX(0); } .flip.out { -webkit-transform: rotateY(-90deg) scale(.9); -webkit-animation-name: flipouttoleft; -webkit-animation-duration: 175ms; transform: rotateY(-90deg) scale(.9); animation-name: flipouttoleft; animation-duration: 175ms;
}@H_607_6@
<div class="viewport-flip"> <a href="#" class="flip out"><img src="images-BACk.jpg" alt="背面"></a> <a href="#" class="flip"><img src="images.jpg" alt="正面"></a> </div>
if ($(this).hasClass("out")) { eleBACk = $(this); } else { eleFront = $(this); }
var step = (imgH/10).toFixed(2),posArr = []; //数字位置 for(var i=0;i<=9;i++){ posArr[i] = steP*i; }
n1 = Math.round(R_97_11845@ath.random()*9); ... finPos_1 = posArr[n1] ... $("#mation-1").animate({"top":"-"+finPos_1+"px"},1000); ... $("#mation-1").attr("date-num",n1);
<audio id="openAudio" src="slot.mp3" preload="preload"></audio> document.getElementById("openAudio").play();
用了插件
jquery.touchSwipe.min.js@H_607_6@
$("#mation-1,#mation-2,#mation-3").swipe({ swipe:function(event,direction,distance,duration,fingerCount,fingerData) { slotSwipe($(this),direction); },threshold:2 }); //手指滑动方向函数 var slotSwipe =function(obj,dir){ var dNum =parseInt(obj.attr("date-num")); if(dir == "down"){ dNum--; if(dNum < 0){ return false; } }else if(dir == "up"){ dNum++; if(dNum > 9){ return false; } } obj.attr("date-num",dNum); obj.animate({"top":"-"+posArr[dNum]+"px"},100); }
demo:
https://github.com/dandanze/flip-css3-animation@H_607_6@
以上是大佬教程为你收集整理的html5 animate for game全部内容,希望文章能够帮你解决html5 animate for game所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。