2 Star 3 Fork 1

junhui.liu/抽奖系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.js 25.33 KB
一键复制 编辑 原始数据 按行查看 历史
笑一笑过 提交于 2018-02-08 11:29 . 12321
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
/**
* Created by junhui on 2018/1/28.
*/
(function () {
"use strict";
var personArray = new Array;
var CurPersonNum = 0;
var gift = false;
var userNum = 66;
let isRender = false;
let setUserNum;//签到人数
let voteData;//签到人数
let fly = new Fly();
let myCharts ;
fly.config.timeout=5000;
var giftUser = new Vue({
el: '#getGift',
data: {
name: '刘俊辉',
gift: '一等奖',
title:'奥克斯50升冰箱',
user_url:'img/a.png',
gift_url:'img/logo.png',
},
});
var menu = new Vue({
el: '#menu',
data:{
level: 0,
},
methods:{
//设置奖品等级
setLevel:(value,e)=>{
console.log(value,menu.level);
if(menu.level == value){
$('#level'+value).removeClass();
menu.level = menu.level ==0? value:0;
if(menu.level!=0){
$('#level'+value).addClass("click-bt");
}
}else {
$('#level'+menu.level).removeClass();
$('#level'+value).addClass("click-bt");
menu.level = value;
}
if(value == 1){
giftUser.gift = '一等奖'
}else if(value == 2){
giftUser.gift = '二等奖'
}else if(value == 3){
giftUser.gift = '三等奖'
}
// $('level'+value)[0].className = 'click-bt';
}
}
});
var vote = new Vue({
el:'#info',
data:{
vote:true,
result:false,
voteContent:[
{level:'第一名',team_name:'人民公社队',vote:96,team_url:'./img/logo.png'},
{level:'第一名',team_name:'人民公社队1111',vote:96,team_url:'./img/logo.png'},
{level:'第一名',team_name:'人民公社队11111111',vote:96,team_url:'./img/logo.png'},
],
}
});
// animate
var _in = ['bounceIn','bounceInDown','bounceInLeft','bounceInRight','bounceInUp','fadeIn','fadeInDown','fadeInDownBig','fadeInLeft','fadeInLeftBig','fadeInRight','fadeInRightBig','fadeInUp','fadeInUpBig','rotateIn','rotateInDownLeft','rotateInDownRight','rotateInUpLeft','rotateInUpRight','slideInDown','slideInLeft','slideInRight'];
var _out = ['bounceOut','bounceOutDown','bounceOutLeft','bounceOutRight','bounceOutUp','fadeOut','fadeOutDown','fadeOutDownBig','fadeOutLeft','fadeOutLeftBig','fadeOutRight','fadeOutRightBig','fadeOutUp','fadeOutUpBig','rotateOut','rotateOutDownLeft','rotateOutDownRight','rotateOutUpLeft','rotateOutUpRight','slideOutDown','slideOutLeft','slideOutRight'];
var rand_in,rand_out;
function getMessage() {
//获取弹幕内容
const host = 'https://my.acc8.cn/common-api/get-message';
return fly.post(host)
.then(function (response) {
let data = JSON.parse(response.data);
console.log('更新弹幕。。。');
data.info.map((item)=>{
let {text,user_name} = item;
sendWard(text,user_name);
});
})
.catch(function (error) {
console.log(error);
});
}
function getUserList(){
//获取用户列表数据
const host = 'https://my.acc8.cn/common-api/get-user';
return fly.post(host)
.then(function (response) {
// $('#container').empty();
let data = JSON.parse(response.data);
console.log('更新签到数据。。。');
data.info.map((item)=>{
let {text,user_name} = item;
$(`#imgId`+item.id).attr("src",item.url);
});
if(data.info.length == userNum){
clearInterval(setUserNum);
}
})
.catch(function (error) {
console.log(error);
});
}
function getUserGift(success,err) {
// 抽取奖品信息
const host = 'https://my.acc8.cn/common-api/get-gift';
var formData = new FormData();
formData.append('level', menu.level);
return fly.post(host,formData)
.then(function (response) {
// $('#container').empty();
let data = JSON.parse(response.data);
success(data);
console.log('抽取奖品信息。。。',data.info);
})
.catch(function (error) {
console.log(error);
});
}
function getVote() {
const host = 'https://my.tj520.cn/common-api/get-team';
return fly.post(host)
.then(function (response) {
// $('#container').empty();
let data = JSON.parse(response.data);
console.log('投票信息。。。',data.info);
let labels = [];
let dataSource = [];
data.info.map((item,index)=>{
labels.push(item.name);
dataSource.push(Number(item.vote))
});
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();
let sec = date.getSeconds();
myCharts.setOption({
title: {
text: year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+sec+' 更新投票'
},
tooltip: {},
legend: {
data:['投票结果'],
},
grid:{
top:'40%'
},
xAxis: {
data: labels,
axisLabel:{
interval:0,
fontWeight:500,
fontSize:18,
rotate:15
},
},
yAxis: {
max:70
},
series: [{
name: '',
type: 'bar',
data: dataSource
}],
textStyle:{
color:'#ffffff'
},
color:['#a7dbf3']
});
})
.catch(function (error) {
console.log(error);
});
}
function getVoteResult() {
const host = 'https://my.tj520.cn/common-api/get-tram-order';
return fly.post(host)
.then(function (response) {
let data = JSON.parse(response.data);
console.log('投票结果。。。',data.info);
let result = data.info;
vote.voteContent = result;
})
.catch(function (error) {
console.log(error);
});
}
// 生成虚拟数据
for(var i=1;i<=66;i++){
personArray.push({
image: "img/default.png",
id: 'imgId'+i
});
}
//设置随机颜色值
function setColor() {
var i = Math.floor(256 * (Math.random()));
return i;
}
//让发射的消息动起来
function moveObj(obj) {
var topMax = $("#info").height();
var _top = Math.floor(topMax * (Math.random())); //设置top初始位置为面板高度内的随机数
if (_top + obj.height() >= topMax) {
_top -= obj.height();
}
// var _left = $("#info").width() - obj.width(); //设置left初始位置位于显示面板最右侧
var _left = $("#info").width(); //设置left初始位置位于显示面板最右侧
//初始化消息位置
obj.css({
"top": _top,
"left": _left,
"color": "rgb(" + setColor() + "," + setColor() + "," + setColor() + ")" //调用 setColor 函数设置随机颜色
});
//移动时间
var time = 10000 + 10000 * Math.random();
//进行动画,动画结束后通过回调函数把消息从面板中删除
obj.animate({
left: -$("#info").offset().left - obj.width()
}, time, function () {
obj.remove();
});
}
//单击发送弹幕
function sendWard(word,user_name) {
//当输入的值不为空时,执行以下代码
if (word != "") {
//<img class="moveWord-img" src='${img}'/>
var obj = $(`<div class='moveWord'> <span class="moveWord-name">${user_name}:</span> <span class="moveWord-word">${word}</span></div>`); //为word值生成对象
$("#info").append(obj); //将生成的对象附加到面板上
moveObj(obj); //调用 moveObj 函数使生成的对象动起来
}
}
var table = new Array;
for (var i = 0; i < personArray.length; i++) {
table[i] = new Object();
if (i < personArray.length) {
table[i] = personArray[i];
table[i].src = personArray[i].thumb_image;
table[i].id = personArray[i].id;
}
table[i].p_x = i % 20 + 1;
table[i].p_y = Math.floor(i / 20) + 1;
}
/*var table = [
"H", "Hydrogen", "1.00794", 1, 1,
"He", "Helium", "4.002602", 18, 1,
"Li", "Lithium", "6.941", 1, 2,
"Be", "Beryllium", "9.012182", 2, 2,
"B", "Boron", "10.811", 13, 2,
"C", "Carbon", "12.0107", 14, 2,
"N", "Nitrogen", "14.0067", 15, 2,
"O", "Oxygen", "15.9994", 16, 2,
"F", "Fluorine", "18.9984032", 17, 2,
"Ne", "Neon", "20.1797", 18, 2,
"Na", "Sodium", "22.98976...", 1, 3,
"Mg", "Magnesium", "24.305", 2, 3,
"Al", "Aluminium", "26.9815386", 13, 3,
"Si", "Silicon", "28.0855", 14, 3,
"P", "Phosphorus", "30.973762", 15, 3,
"S", "Sulfur", "32.065", 16, 3,
"Cl", "Chlorine", "35.453", 17, 3,
"Ar", "Argon", "39.948", 18, 3,
"K", "Potassium", "39.948", 1, 4,
"Ca", "Calcium", "40.078", 2, 4,
"Sc", "Scandium", "44.955912", 3, 4,
"Ti", "Titanium", "47.867", 4, 4,
"V", "Vanadium", "50.9415", 5, 4,
"Cr", "Chromium", "51.9961", 6, 4,
"Mn", "Manganese", "54.938045", 7, 4,
"Fe", "Iron", "55.845", 8, 4,
"Co", "Cobalt", "58.933195", 9, 4,
"Ni", "Nickel", "58.6934", 10, 4,
"Cu", "Copper", "63.546", 11, 4,
"Zn", "Zinc", "65.38", 12, 4,
"Ga", "Gallium", "69.723", 13, 4,
"Ge", "Germanium", "72.63", 14, 4,
"As", "Arsenic", "74.9216", 15, 4,
"Se", "Selenium", "78.96", 16, 4,
"Br", "Bromine", "79.904", 17, 4,
"Kr", "Krypton", "83.798", 18, 4,
"Rb", "Rubidium", "85.4678", 1, 5,
"Sr", "Strontium", "87.62", 2, 5,
"Y", "Yttrium", "88.90585", 3, 5,
"Zr", "Zirconium", "91.224", 4, 5,
"Nb", "Niobium", "92.90628", 5, 5,
"Mo", "Molybdenum", "95.96", 6, 5,
"Tc", "Technetium", "(98)", 7, 5,
"Ru", "Ruthenium", "101.07", 8, 5,
"Rh", "Rhodium", "102.9055", 9, 5,
"Pd", "Palladium", "106.42", 10, 5,
"Ag", "Silver", "107.8682", 11, 5,
"Cd", "Cadmium", "112.411", 12, 5,
"In", "Indium", "114.818", 13, 5,
"Sn", "Tin", "118.71", 14, 5,
"Sb", "Antimony", "121.76", 15, 5,
"Te", "Tellurium", "127.6", 16, 5,
"I", "Iodine", "126.90447", 17, 5,
"Xe", "Xenon", "131.293", 18, 5,
"Cs", "Caesium", "132.9054", 1, 6,
"Ba", "Barium", "132.9054", 2, 6,
"La", "Lanthanum", "138.90547", 4, 9,
"Ce", "Cerium", "140.116", 5, 9,
"Pr", "Praseodymium", "140.90765", 6, 9,
"Nd", "Neodymium", "144.242", 7, 9,
"Pm", "Promethium", "(145)", 8, 9,
"Sm", "Samarium", "150.36", 9, 9,
"Eu", "Europium", "151.964", 10, 9,
"Gd", "Gadolinium", "157.25", 11, 9,
"Tb", "Terbium", "158.92535", 12, 9,
"Dy", "Dysprosium", "162.5", 13, 9,
"Ho", "Holmium", "164.93032", 14, 9,
"Er", "Erbium", "167.259", 15, 9,
"Tm", "Thulium", "168.93421", 16, 9,
"Yb", "Ytterbium", "173.054", 17, 9,
"Lu", "Lutetium", "174.9668", 18, 9,
"Hf", "Hafnium", "178.49", 4, 6,
"Ta", "Tantalum", "180.94788", 5, 6,
"W", "Tungsten", "183.84", 6, 6,
"Re", "Rhenium", "186.207", 7, 6,
"Os", "Osmium", "190.23", 8, 6,
"Ir", "Iridium", "192.217", 9, 6,
"Pt", "Platinum", "195.084", 10, 6,
"Au", "Gold", "196.966569", 11, 6,
"Hg", "Mercury", "200.59", 12, 6,
"Tl", "Thallium", "204.3833", 13, 6,
"Pb", "Lead", "207.2", 14, 6,
"Bi", "Bismuth", "208.9804", 15, 6,
"Po", "Polonium", "(209)", 16, 6,
"At", "Astatine", "(210)", 17, 6,
"Rn", "Radon", "(222)", 18, 6,
"Fr", "Francium", "(223)", 1, 7,
"Ra", "Radium", "(226)", 2, 7,
"Ac", "Actinium", "(227)", 4, 10,
"Th", "Thorium", "232.03806", 5, 10,
"Pa", "Protactinium", "231.0588", 6, 10,
"U", "Uranium", "238.02891", 7, 10,
"Np", "Neptunium", "(237)", 8, 10,
"Pu", "Plutonium", "(244)", 9, 10,
"Am", "Americium", "(243)", 10, 10,
"Cm", "Curium", "(247)", 11, 10,
"Bk", "Berkelium", "(247)", 12, 10,
"Cf", "Californium", "(251)", 13, 10,
"Es", "Einstenium", "(252)", 14, 10,
"Fm", "Fermium", "(257)", 15, 10,
"Md", "Mendelevium", "(258)", 16, 10,
"No", "Nobelium", "(259)", 17, 10,
"Lr", "Lawrencium", "(262)", 18, 10,
"Rf", "Rutherfordium", "(267)", 4, 7,
"Db", "Dubnium", "(268)", 5, 7,
"Sg", "Seaborgium", "(271)", 6, 7,
"Bh", "Bohrium", "(272)", 7, 7,
"Hs", "Hassium", "(270)", 8, 7,
"Mt", "Meitnerium", "(276)", 9, 7,
"Ds", "Darmstadium", "(281)", 10, 7,
"Rg", "Roentgenium", "(280)", 11, 7,
"Cn", "Copernicium", "(285)", 12, 7,
"Uut", "Unutrium", "(284)", 13, 7,
"Fl", "Flerovium", "(289)", 14, 7,
"Uup", "Ununpentium", "(288)", 15, 7,
"Lv", "Livermorium", "(293)", 16, 7,
"Uus", "Ununseptium", "(294)", 17, 7,
"Uuo", "Ununoctium", "(294)", 18, 7
];*/
var camera, scene, renderer;
var controls;
var objects = [];
var targets = { table: [], sphere: [], helix: [], grid: [] };
let speed = 0.008;
function addSpeed() {
speed += 0.002;
console.log('add...')
}
function reduceSpeed() {
speed-=0.002;
console.log('reduce...')
}
let slowSpeed,maxSpeed;
function stopSpeed() {
console.log(slowSpeed,maxSpeed);
if(maxSpeed){
clearInterval(maxSpeed);
}
slowSpeed = setInterval(()=>{
speed -= 0.05;
if(speed < 0){
speed = 0;
clearInterval(slowSpeed);
openGift();
}
},500);
console.log('stop...')
}
function getGift() {
maxSpeed = setInterval(()=>{
speed += 0.005;
if(speed > 0.1){
console.log('max speed... ');
speed = 0.1;
clearInterval(maxSpeed);
}
},500);
console.log('gift...');
}
function openGift() {
let promise = new Promise((success,err)=>{
getUserGift(success,err);
});
promise.then((data)=>{
// get animate
if(data.info.length==0){
sweetAlert("奖品已经被抽完啦!", data.message,"error");
return ;
}
let gift = data.info.gift;
let user = data.info.user[0];
giftUser.gift_url = gift.gift_url;
giftUser.title = gift.title;
giftUser.name = user.user_name;
giftUser.user_url = user.user_url;
rand_in = parseInt(Math.random() * _in.length,10);
rand_out = parseInt(Math.random() * _out.length,10);
if(CurPersonNum >= personArray.length){
CurPersonNum = 0;
}
$('.show_info').show();
$('.show_info').addClass(_in[rand_in]);
console.info('已获得奖品。。。',data);
});
}
init();
animate();
bindBt();
// 模拟推送数据
var msg = setInterval(function(){
getMessage();
},3000);
setUserNum = setInterval(function(){
getUserList();
},10000);
function bindBt() {
//绑定按钮
let add = $('#add');
let reduce = $('#reduce');
let stop = $('#stop');
let gift = $('#gift');
let close_bt = $('.close-bt');
let voteId = $('#vote');
let result = $('#result');
// add[0].onclick = addSpeed;
// reduce[0].onclick = reduceSpeed;
stop[0].onclick = stopSpeed;
gift[0].onclick = getGift;
close_bt[0].onclick = ()=>{
// $('#getGift').css('display','none');
$('.show_info').removeClass(_in[rand_in]);
// 更改展示的图片
$('.show_info').addClass(_out[rand_out]);
setTimeout(function(){
speed = 0.008;
$('.show_info').removeClass(_out[rand_out]);
$('.show_info').hide();
},1000);
};
voteId[0].onclick = ()=>{
let display = !vote.vote;
vote.vote = display;
$('#container').css('display',display?'block':'none');
$('.logo').css('display',display?'block':'none');
$('#menu').css('display',display?'block':'none');
$('#myChart').css('display',!display?'block':'none');
$('#result').css('display',!display?'block':'none');
if(!display){
myCharts = echarts.init(document.getElementById('myChart'));
getVote();
voteData = setInterval(getVote,2000);
}else {
voteData?clearInterval(voteData):'';
}
};
result[0].onclick = ()=>{
console.log(vote.result);
let display = !vote.result;
vote.result = display;
$('#voteResult').css('display',display?'block':'none');
$('#myChart').css('display',!display?'block':'none');
if(display){
getVoteResult();
}
};
console.info(add,reduce)
}
function init() {
camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 3000;
scene = new THREE.Scene();
// table
for ( var i = 0; i < table.length; i ++ ) {
var element = document.createElement( 'div' );
element.className = 'element';
element.style.backgroundColor = 'rgba(0,127,127,' + ( Math.random() * 0.5 + 0.25 ) + ')';
var img = document.createElement('img');
img.src = table[ i ].image;
img.id = table[ i ].id;
element.appendChild( img );
/*var number = document.createElement( 'div' );
number.className = 'number';
number.textContent = (i/5) + 1;
element.appendChild( number );
var symbol = document.createElement( 'div' );
symbol.className = 'symbol';
symbol.textContent = table[ i ];
element.appendChild( symbol );
var details = document.createElement( 'div' );
details.className = 'details';
details.innerHTML = table[ i + 1 ] + '<br>' + table[ i + 2 ];
element.appendChild( details );*/
var object = new THREE.CSS3DObject( element );
object.position.x = Math.random() * 4000 - 2000;
object.position.y = Math.random() * 4000 - 2000;
object.position.z = Math.random() * 4000 - 2000;
scene.add( object );
objects.push( object );
// 表格需要坐标进行排序的
var object = new THREE.Object3D();
// object.position.x = ( table[ i + 3 ] * 140 ) - 1330;
// object.position.y = - ( table[ i + 4 ] * 180 ) + 990;
object.position.x = ( table[ i ].p_x * 200 ) - 1330;
object.position.y = - ( table[ i ].p_y * 240 ) + 990;
targets.table.push( object );
}
// sphere
var vector = new THREE.Vector3();
var spherical = new THREE.Spherical();
for ( var i = 0, l = objects.length; i < l; i ++ ) {
var phi = Math.acos( -1 + ( 2 * i ) / l );
var theta = Math.sqrt( l * Math.PI ) * phi;
var object = new THREE.Object3D();
spherical.set( 800, phi, theta );
object.position.setFromSpherical( spherical );
vector.copy( object.position ).multiplyScalar( 2 );
object.lookAt( vector );
targets.sphere.push( object );
}
// helix
var vector = new THREE.Vector3();
var cylindrical = new THREE.Cylindrical();
for ( var i = 0, l = objects.length; i < l; i ++ ) {
var theta = i * 0.175 + Math.PI;
var y = - ( i * 5 ) + 450;
var object = new THREE.Object3D();
// 参数一 圈的大小 参数二 左右间距 参数三 上下间距
cylindrical.set( 1200, theta, y );
object.position.setFromCylindrical( cylindrical );
vector.x = object.position.x * 2;
vector.y = object.position.y;
vector.z = object.position.z * 2;
object.lookAt( vector );
targets.helix.push( object );
}
// grid
for ( var i = 0; i < objects.length; i ++ ) {
var object = new THREE.Object3D();
object.position.x = ( ( i % 5 ) * 400 ) - 800; // 400 图片的左右间距 800 x轴中心店
object.position.y = ( - ( Math.floor( i / 5 ) % 5 ) * 300 ) + 500; // 500 y轴中心店
object.position.z = ( Math.floor( i / 25 ) ) * 200 - 800;// 300调整 片间距 800z轴中心店
targets.grid.push( object );
}
//渲染
renderer = new THREE.CSS3DRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.domElement.style.position = 'absolute';
document.getElementById( 'container' ).appendChild( renderer.domElement );
// 鼠标控制
controls = new THREE.TrackballControls( camera, renderer.domElement );
controls.rotateSpeed = 0.5;
controls.minDistance = 500;
controls.maxDistance = 6000;
controls.addEventListener( 'change', render );
// 自动更换
var ini = 0;
setInterval(function(){
ini = ini >= 3 ? 0 : ini;
++ini;
switch(ini){
case 1:
transform( targets.sphere, 1000 );
break;
case 2:
transform( targets.helix, 1000 );
break;
case 3:
transform( targets.grid, 1000 );
break;
}
},8000);
var button = document.getElementById( 'table' );
button.addEventListener( 'click', function ( event ) {
transform( targets.table, 1000 );
}, false );
var button = document.getElementById( 'sphere' );
button.addEventListener( 'click', function ( event ) {
transform( targets.sphere, 2000 );
}, false );
var button = document.getElementById( 'helix' );
button.addEventListener( 'click', function ( event ) {
transform( targets.helix, 2000 );
}, false );
var button = document.getElementById( 'grid' );
button.addEventListener( 'click', function ( event ) {
transform( targets.grid, 2000 );
}, false );
transform( targets.table, 2000 );
//
window.addEventListener( 'resize', onWindowResize, false );
}
function transform( targets, duration ) {
TWEEN.removeAll();
for ( var i = 0; i < objects.length; i ++ ) {
var object = objects[ i ];
var target = targets[ i ];
new TWEEN.Tween( object.position )
.to( { x: target.position.x, y: target.position.y, z: target.position.z }, Math.random() * duration + duration )
.easing( TWEEN.Easing.Exponential.InOut )
.start();
new TWEEN.Tween( object.rotation )
.to( { x: target.rotation.x, y: target.rotation.y, z: target.rotation.z }, Math.random() * duration + duration )
.easing( TWEEN.Easing.Exponential.InOut )
.start();
}
new TWEEN.Tween( this )
.to( {}, duration * 2 )
.onUpdate( render )
.start();
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
render();
}
function animate() {
// 让场景通过x轴或者y轴旋转 & z
// scene.rotation.x += 0.011;
scene.rotation.y += speed;
requestAnimationFrame( animate );
TWEEN.update();
controls.update();
// 渲染循环
render();
}
function render() {
renderer.render( scene, camera );
}
})();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/junhui_liu/ChouJiangXiTong.git
git@gitee.com:junhui_liu/ChouJiangXiTong.git
junhui_liu
ChouJiangXiTong
抽奖系统
master

搜索帮助