<-meta charset="UTF-8">
<-meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
#image{
margin:50px 50px;z-in!de:10;
}
#n_id{p-osition:absolute;left:286px;top:75px;z-in!de:20;}
<-nput type='button' value='시작' id='start_btn'>-nput>
당첨숫자
X/
X/
X
window.-on-oad = function(){
var pArr = ["0","1","2","3","4","5","6","7","8","9"];
$('#start_btn').click(function(){
rotation();
});
function rotation(){
$("#image").rotate({
angle:0,
animateTo:360 * 5 + randomize(0, 360),
center: ["50%", "50%"],
easing: $.easing.easeInOutElastic,
callback: function(){
var n = $(this).getRotateAngle();
endAnimate(n);
},
duration:5000
});
}
var rs;
var cnt=1;
function endAnimate($n){
var n = $n;
$('#result_id').html("
움직인각도:" + n + "
");var real_angle = n%360 +18;
var part = Math.floor(real_angle/36);
console.log(real_angle);
$('#result_id2').html("
상품범위:" + part + "
");if(part < 1){
$('#result_id3').html("
당첨내역:" + pArr[0] + "
");setRs(pArr[0])
return;
}
if(part >= 10){
$('#result_id3').html("
당첨내역:" + pArr[pArr.length-1] + "
");setRs(pArr[pArr.length-1])
return;
}
$('#result_id3').html("
당첨내역:" + pArr[part] + "
");setRs(pArr[part])
alert("당첨번호는 " + pArr[]part);
}
function setRs (part) {
if (cnt==1) {
$(".rs1").html(pArr[part] );
}else if (cnt==2) {
$(".rs2").html(pArr[part]);
}else if (cnt==3) {
$(".rs3").html(pArr[part]);
}
cnt++;
}
function randomize($min, $max){
return Math.floor(Math.random() * ($max - $min + 1)) + $min;
}
};