Giter Site home page Giter Site logo

heeroluo / danmaku-demo Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 13.0 357 KB

Just a demo for explaining the principle of Danmaku.

Home Page: https://mrluo.life/article/detail/146/danmaku-implement

License: MIT License

JavaScript 93.87% CSS 0.77% HTML 5.36%
danmaku

danmaku-demo's People

Contributors

heeroluo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

danmaku-demo's Issues

在danmuku.js的_addToTrack方法中,是否要判定y集合是否为连续数值

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;

}

当resize 从大变小时,_removeFromTrack滞后性,此时 this.tracks[i] 可能 undefined,即不存在

_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
            }
        }
    })
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.