heeroluo / danmaku-demo Goto Github PK
View Code? Open in Web Editor NEWJust a demo for explaining the principle of Danmaku.
Home Page: https://mrluo.life/article/detail/146/danmaku-implement
License: MIT License
Just a demo for explaining the principle of Danmaku.
Home Page: https://mrluo.life/article/detail/146/danmaku-implement
License: MIT License
if (y.length >= data.useTracks) {
data.y = y;
// y:表示所占轨道序号(下标)的集合有没有可能,y不是顺序的
// 假设:useTracks=4 ,y=[1,4,5,6],那此时已 data.y[0]作为top,往下4个轨道单位,是会和2,3轨道的前一个最后的弹幕
// 重叠的?是这样吗
y.forEach((i) => {
this._tracks[i].push(data)
});
break;
}
_removeFromTrack(y, id) {
y.forEach((i) => {
const track = this._tracks[i];
// if(typeof track==='undefined') /* resize 导致 tracks 改变 */
// return
// 当resize 从大变小时,由于_removeFromTrack滞后性,此时 this.tracks[i] 可能 undefined,即不存在
for (let j = 0; j < track.length; j++) {
//console.log(track[j].uId,id)
if (track[j].uId === id) {
/* array.splice(index,howmany,item1,......,itemX) */
track.splice(j, 1)
break
}
}
})
}
Math.floor(data.totalDistance * 0.0058 * (Math.random() * 0.3 + 0.7));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.