雄聯盟幸運召喚師10月22日有開放嗎?本周幸運召喚師什么時候開放?以下是幸運召喚師今天的活動地址和抽獎攻略,一起來了解一下吧。
問:英雄聯盟幸運召喚師10月22日有開放嗎?
答:最新一期的幸運召喚師已經在10月21日開放,結束時間會到10月31日,大家可要把握好本期活動時間抽取折扣皮佛!
【幸運召喚師抽獎地址】
本期活動地址:http://lol.qq.com/act/a20180224lucky/index.html
【幸運召喚師抽獎攻略】
想要參與折扣抽獎,要先獲得活動資格,一般當月沒有購買過皮膚的玩家比較容易收到官方贈送的資格,或者登記較低,剛剛注冊賬號的玩家,所以如果自己一直收不到資格,可以用小號登錄看看,沒有小號等級又高的話就沒辦法了,只能看運氣。
至于怎么抽到1折,建議參與網頁版抽獎,比在游戲中概率高一點,此外,避開游戲高峰期要比高峰期概率大點,可以去試試看。
以上就是今天幸運召喚師活動攻略。
獎和開盲盒性質一樣的都是通過ajax讀取后臺的隨機數據。
圖1 轉輪盤抽獎
圖2 轉輪盤抽獎結果
1、轉輪盤
本來是想直接繪圖實現輪盤,但是沒有找到怎么填充文字,只好把輪盤弄成了背景圖,通常用于游戲抽道具,商城積分抽獎,公司年末員工抽獎
html代碼
<style>
.box{
width:500px;height:500px;border:0px solid #DDD;margin:100px;position:relative;
}
.beij{
background:url(cjbg.jpg) no-repeat center center;width:100%;height:100%;
}
.pointer{
cursor:pointer;position:absolute;top:50%;left:50%;margin-left:-40px;margin-top:-48px;background:url(c1.png) no-repeat center center;width:80px;height:96px;z-index:21;
}
</style>
<div class='box' >
<div class='beij'></div>
<div class='pointer'></div>
</div>
js代碼
<script>
$(document).ready(function() {
var time=0.4;//轉一圈所需時間 s
var count=10;//默認多轉幾圈
/*
var angle=new Array();
angle[0]=23;
angle[1]=53;
angle[2]=83;
angle[3]=110;
angle[4]=133;
angle[5]=163;
angle[6]=223;
*/
var i=1;
$(".pointer").click(function(){
$.ajax({
url: "/public/man/index.php/api/choujiang",
data:'',
type: "post",
dataType: "json",
success: function(result) {
//console.log(result.msg);
$('.beij').css({'transform':"rotate("+(i*count*360+result.angle)+"deg)","transition":" All "+(time*(5+result.angle/360))+"s ease-in-out"});
//彈窗提示
//setTimeout("alert('"+result.msg+"');",time*1000*(5+result.angle/360));
setTimeout("console.log('"+result.msg+"');",time*1000*(5+result.angle/360));
}
})
i++;
});
});
</script>
說明:
后臺接口程序
public function choujiang(){
/*
id 獎品編號
title 中獎提示
prec 中獎概率
angle 旋轉角度
*/
$arr[0]=array('id'=>1,'title'=>'恭喜抽中一等獎:蘋果手機一部!','prec'=>1,'angle'=>23);
$arr[1]=array('id'=>2,'title'=>'恭喜抽中二等獎:Ipad','prec'=>2,'angle'=>68);
$arr[2]=array('id'=>3,'title'=>'恭喜抽中三等獎:','prec'=>25,'angle'=>113);
$arr[3]=array('id'=>4,'title'=>'恭喜抽中四等獎','prec'=>50,'angle'=>155);
$arr[4]=array('id'=>5,'title'=>'恭喜抽中五等獎','prec'=>80,'angle'=>202);
$arr[5]=array('id'=>6,'title'=>'恭喜抽中六等獎','prec'=>150,'angle'=>245);
$arr[6]=array('id'=>7,'title'=>'恭喜抽中七等獎','prec'=>240,'angle'=>290);
$arr[7]=array('id'=>8,'title'=>'獲得50元優惠券,還需加油哦!','prec'=>380,'angle'=>337);
//中獎幾率求和
$cmun=0;
for($i=0;$i<=count($arr)-1;$i++){
$cmun+=$arr[$i]['prec'];
}
//中獎隨機數
$smrand=mt_rand(1,$cmun);
$this->getRand(1,0,$arr,count($arr),$smrand);
}
public function getrand($m,$im,$arr,$count,$smrand){
/*
$m 起始數
$im 第幾個數組元素
$count 數組總得元素個數
$arr 原始數組
$smrand 中獎隨機數
*/
//已經中獎
if($smrand>=$m&&$smrand<=$arr[$im]['prec']+$m-1){
//中獎返回
$msg=array('msg'=>$arr[$im]['title'],'angle'=>$arr[$im]['angle'],'smrand'=>$smrand);
exit(json_encode($msg,JSON_UNESCAPED_UNICODE));
}else{
//最后一個不需要判斷 直接返回
if($im+1==$count-1){
$msg=array('msg'=>$arr[$count-1]['title'],'angle'=>$arr[$count-1]['angle'],'smrand'=>$smrand);
exit(json_encode($msg,JSON_UNESCAPED_UNICODE));
}else{
//起始數字
$start=$arr[$im]['prec']+$m;
//遞歸 再次調用數組 讀取下一個數組元素
$this->getrand($start,$im+1,$arr,$count,$smrand);
}
}
}
說明:
2、隨機抽取一個幸運員工
點擊開始抽獎,單行文本框循環顯示員工,抽獎按鈕文字變為停止,點擊停止的時候,抽中的員工顯示在獲獎名單。
圖3 隨機抽取幸運員工
html代碼
<style>
body{
background:#DDD;
}
.title{
height:40px;line-height:40px;font-size:14px;font-weight:bold;margin:100px 0 0 100px;
}
.box{
width:700px;height:200px;border:1px solid #EEE;border-radius:8px;background:#FFF;margin-left:100px;
}
.box li{height:30px;line-height:30px;}
.cjbtn{
margin:10px 0 0 100px;
}
#ygname{
padding:3px 5px;;
}
</style>
<div class='title'>獲獎名單</div>
<div class='box' >
<ul>
</ul>
</div>
<div class='cjbtn'><input type='text' id='ygname' /> <button id='choujiang'>開始抽獎</button></div>
js代碼
<script>
var t;
var yuangong=new Array();
$.ajax({
url: "/public/man/index.php/api/yuangong",
data:'',
type: "post",
dataType: "json",
success: function(result) {
yuangong=result.msg
}
})
$(document).ready(function() {
$("#choujiang").click(function(){
if($(this).html()=='開始抽獎'){
if(yuangong.length>=3){
$(this).html("停止");
start();
}
}else{
$(this).html("開始抽獎");
stop();
}
});
});
function start() {
num = Math.floor(Math.random() * (yuangong.length-1));
$('#ygname').val(yuangong[num]['title']);
t = setTimeout(start, 0);
}
function stop() {
clearInterval(t);
//數組中刪除中獎員工信息防止重復中獎
yuangong.splice($.inArray(yuangong[num], yuangong), 1);
$(".box ul").append("<li>"+$('#ygname').val()+"</li>");
}
</script>
說明:
num = Math.floor(Math.random() * (yuangong.length));
綜上:num得到的是0到數組下標的隨機數。
clearInterval(t):用于停止t = setTimeout(start, 0);
后臺php接口程序
public function yuangong(){
$yuangong[0]=array('id'=>1,'title'=>'業務部【張三】');
$yuangong[1]=array('id'=>2,'title'=>'技術部【李四】');
$yuangong[2]=array('id'=>3,'title'=>'技術部【逍遙】');
$yuangong[3]=array('id'=>4,'title'=>'會計部【薛嫣】');
$yuangong[4]=array('id'=>5,'title'=>'行政部【王五】');
$yuangong[5]=array('id'=>6,'title'=>'行政部【王天林】');
$yuangong[6]=array('id'=>7,'title'=>'行政部【李笑和】');
$msg=array('msg'=>$yuangong);
exit(json_encode($msg,JSON_UNESCAPED_UNICODE));
}
3、隨機抽取多個幸運員工
沒有想到什么效果,只是單純地獲取了隨機數
html代碼
<style>
body{
background:#DDD;
}
.title{
height:40px;line-height:40px;font-size:14px;font-weight:bold;margin:100px 0 0 100px;
}
.box{
width:700px;height:200px;border:1px solid #EEE;border-radius:8px;background:#FFF;margin-left:100px;
}
.box li{height:30px;line-height:30px;}
.cjbtn{
margin:10px 0 0 100px;
}
#ygname{
padding:3px 5px;;
}
</style>
<div class='title'>獲獎名單</div>
<div class='box' >
<ul>
</ul>
</div>
<div class='cjbtn'> <button id='choujiang'>開始抽獎</button></div>
js代碼
<script>
var yuangong=new Array();
var ygstr='';//存取獲獎員工
var ygrs=5;//一次抽幾個
var t;
$.ajax({
url: "/public/man/index.php/api/yuangong",
data:'',
type: "post",
dataType: "json",
success: function(result) {
yuangong=result.msg
}
})
$(document).ready(function() {
$("#choujiang").click(function(){
if(yuangong.length>=ygrs){
start(1);
}
});
});
function start(ms) {
//ms 第幾次獲取員工信息
num = Math.floor(Math.random() * (yuangong.length));
console.log(num);
ygstr+="<li>"+yuangong[num]['title']+"</li>";
if(ms>=ygrs){
$(".box ul").html(ygstr);
ygstr="";
}else{
yuangong.splice($.inArray(yuangong[num], yuangong), 1);
start(ms+1);
}
}
</script>
4、在線開盲盒
需要我們點擊抽獎的時候通過ajax讀取后臺獲得的盲盒信息,直接顯示到前臺,前臺顯示同上邊的,都是一樣,說一下后臺程序。
使用array_rand().隨機獲取幾個數組元素
array_rand($arr,$count).用法
返回值是原數組的下標。
public function manghe(){
$goods[0]=array('id'=>1,'title'=>'手機');
$goods[1]=array('id'=>2,'title'=>'毛絨玩具');
$goods[2]=array('id'=>3,'title'=>'化妝品');
$goods[3]=array('id'=>4,'title'=>'啫喱水');
$goods[4]=array('id'=>5,'title'=>'面膜');
$goods[5]=array('id'=>6,'title'=>'學習用品');
$goods[6]=array('id'=>7,'title'=>'電腦');
$getarr=array_rand($goods,3);
$i=0;
foreach($getarr as $k){
$rearr[$i]=$goods[$k];
$i++;
}
$msg=array('msg'=>$rearr);
exit(json_encode($msg,JSON_UNESCAPED_UNICODE));
}
如果包含特殊獎項,需要滿足抽獎多少次,一定抽中,可以達到抽獎次數以后在array_rand內隨機數減一,然后把大獎塞進該次抽獎的返回信息。
array_push($rearr,$a)用法:
$tebie[999]=array('id'=>999,'title'=>'特別大獎');
$goods[0]=array('id'=>1,'title'=>'手機');
$goods[1]=array('id'=>2,'title'=>'毛絨玩具');
$goods[2]=array('id'=>3,'title'=>'化妝品');
$goods[3]=array('id'=>4,'title'=>'啫喱水');
$goods[4]=array('id'=>5,'title'=>'面膜');
$goods[5]=array('id'=>6,'title'=>'學習用品');
$goods[6]=array('id'=>7,'title'=>'電腦');
$getarr=array_rand($goods,3);
$i=0;
foreach($getarr as $k){
$rearr[$i]=$goods[$k];
$i++;
}
array_push($rearr,$tebie[999]);
dump($rearr);
exit;
輸出結果:
單的html和js做的抽獎效果,自己也做過抽獎程序,用作年會上面的抽獎,效果不錯,賽光時代小編會后續的分享出來供大家使用得。近些年互聯網飛速發展,周邊的產業不斷的完善微信、手機等等都需要我們企業不斷的擴展和適應。
抽獎效果
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>抽獎程序-saiguangw.com</title>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<style>
* {
margin:0;
padding:0;
}
a {
text-decoration:none;
}
img {
border:none;
}
li {
list-style:none outside none;
}
body {
background:#c9c9c9;
font-size:14px;
font-family:"宋體";
}
.myBox {
margin:50px auto 0;
}
.myBox ul {
margin:0 auto 0;
position:relative;
width:500px;
height:100px;
overflow:hidden;
}
.myBox li {
width:100px;
height:100px;
text-align:center;
line-height:100px;
font-size:40px;
color:#fff;
background:rgba(222,122,155,0.5);
}
.myBox li.on {
background:rgba(66,56,222,0.5);
}
.text {
height:50px;
overflow:hidden;
width:500px;
margin:20px auto 0;
font-size:20px;
line-height:50px;
text-align:center;
}
.bt,.jg,.zt {
float:left;
width:200px;
}
.bt {
width:100px;
height:50px;
background:rgb(200,100,55);
color:#fff;
cursor:pointer;
}
em {
font-size:30px;
font-style:normal;
color:red;
}
</style>
</head>
<body>
<div class="myBox">
<ul class="cj2">
<li>1</li>
</ul>
<div class="text">
<div class="bt bt2">點我抽獎</div>
<div class="jg jg2">中獎者為"<em></em>"號</div>
</div>
</div><script>
//by zyp
;(function($, window, document, undefined) {
var LuckDraw = function(ele, opt) {
this.$element = ele,
this.defaults = {
row: 4, //行
column: 4, //列
spacing: 0,
click: null,
time: 3,
end: function(e) {}
},
this.target,
this.options = $.extend({}, this.defaults, opt);
}
LuckDraw.prototype = {
init: function() {
var $this = this.$element;
var row = this.options.row;
var col = this.options.column;
var spacing = this.options.spacing;
var click = this.options.click;
var allNumber = 2 * (row + col) - 4;
var line = row - 2; //除去上下de行數
var length = $this.children('li').length;
var options = this.options;
if (length < allNumber) {
for (var i = length; i <= (allNumber - length); i++) {
$this.append("<li>" + (i + 1) + "</li>");
}
}
var children = $this.children('li');
var width = children.eq(0).width() || 0;
var height = children.eq(0).height() || 0;
//元素初始化
$this.css({
position: 'relative',
width: col * width + (col - 1) * spacing,
height: row * height + (row - 1) * spacing
});
children.css({
position: 'absolute'
});
if (line == 0) {
initOne();
} else {
initTwo();
}
//初始化函數
//此時分成4個部分,上、右、下、左
//上: 0 ~ col-1
//右: col ~ col+line
//下: col+line+1 ~ 2*col+line-1
//左: else
//如果只有兩行
//此時分成4個部分,上、右、下、左
function initOne() {
children.each(function(index) {
if (index >= 0 && index <= (col - 1)) {
$(this).css({
top: 0,
left: index * width + index * spacing
});
} else {
$(this).css({
bottom: 0,
right: index % col * width
});
}
});
}
//如果大于兩行
function initTwo() {
children.each(function(index) {
if (index >= 0 && index <= (col - 1)) {
$(this).css({
top: 0,
left: index * width + index * spacing
});
} else if (index >= col && index <= (col + line - 1)) {
$(this).css({
top: ((index + 1 - col)) * (height + spacing),
right: 0
});
} else if (index >= (col + line) && index <= (2 * col + line - 1)) {
$(this).css({
bottom: 0,
right: (index - ((col + line))) * (width + spacing)
});
} else {
$(this).css({
left: 0,
bottom: (index - (2 * col + line - 1)) * (height + spacing)
});
}
});
}
var target = $this.target || Math.floor(Math.random() * allNumber + 1); //目標,指定或隨機
var ix = 0; //位置
var stop;
var flg = false; //抽獎是否正在運行
/*
加速度公式
v1 = v0 + a*t;注意加速度的v代表時間
此時的t可以我們自己定義,所以是常量,所以只需要求a的值
*/
var a = -25.0;
var v0 = 500.0;
var t = 0.0,
v;
var time = this.options.time * 1000; //勻速運行的時間,單位秒
$(click).on('click', function() {
if (!flg) {
flg = true;
target = $this.target || Math.floor(Math.random() * allNumber + 1);
speedUp();
} else {
return;
}
});
//加速
function speedUp() {
runner(ix);
if (v <= 50) {
clearTimeout(stop);
v = 50;
t = 0.0;
uniform(); //跳轉到勻速
} else {
t++;
v = v0 + a * t;
stop = setTimeout(speedUp, v);
}
}
//勻速
function uniform() {
stop = setTimeout(uniform, v);
if (t == time / 50) {
clearTimeout(stop);
t = 0.0;
speedDown();
} else {
t++;
}
runner(ix);
}
//減速
function speedDown() {
var stop3 = setTimeout(speedDown, v);
if (v >= 500) {
v = 500;
if (ix == target - 1) {
clearTimeout(stop3);
options.end(target);
flg = false;
}
} else {
t++;
v = v - a * t;
}
runner(ix);
}
//ix++
function runner(i) {
children.removeClass('on').eq(ix).addClass('on');
i++;
if (i == allNumber) {
ix = 0;
} else {
ix = i;
}
}
},
setTarget: function(options) {
var $this = this.$element;
$this.target = options;
}
}
$.fn.myLuckDraw = function(options, target) {
var Ld = new LuckDraw(this, options);
Ld.setTarget(target);
Ld.init();
return this;
}
})(jQuery, window, document);
$(function() {
var tar = 5;
$('.cj2').myLuckDraw({
row: 3, //行
column: 5, //列
spacing: 5, //空隙
click: '.bt2', //點擊觸發
time: 3, //勻速運動的時間
end: function(e) {
//抽獎執行完畢的回調函數,參數e為獲獎編號
//因為這里是指定的,所以e == 12
$('.jg2 em').text(e);
}
});
});</script>
</body>
</html>
*請認真填寫需求信息,我們會在24小時內與您取得聯系。