search

Home  >  Q&A  >  body text

tagCanvas plugin not playing automatically - Stack Overflow

tagCanvas plug-in
This plug-in does not seem to have automatic insertion parameters. Has anyone modified the source code? Can you come over for reference?

Source code address

PHP中文网PHP中文网2724 days ago758

reply all(1)I'll reply

  • 学习ing

    学习ing2017-06-15 09:24:25

    I have never used this plug-in, so I took a look at the source code:

    TCproto.Draw = function() {
        var cv = this.canvas, cw = cv.width, ch = cv.height, max_sc = 0, yaw = this.yaw, pitch = this.pitch,
            x1 = cw / 2, y1 = ch / 2, c = this.ctxt, active, a, i, tl = this.taglist, l = tl.length;
        c.setTransform(1,0,0,1,0,0);
        this.active = null;
        for(i = 0; i < l; ++i)
            tl[i].Calc(yaw, pitch);
        tl = tl.sort(function(a,b) {return a.sc-b.sc});
    
        if(!this.txtOpt && this.shadow) {
            c.shadowBlur = this.shadowBlur;
            c.shadowOffsetX = this.shadowOffset[0];
            c.shadowOffsetY = this.shadowOffset[1];
        }
        c.clearRect(0,0,cw,ch);
        for(i = 0; i < l; ++i) {
            a = tl[i].Draw(c, x1, y1);
            if(a && a.sc > max_sc && (!this.frontSelect || a.z <= 0)) {
                active = a;
                active.index = i;
                max_sc = a.sc;
            }
        }
        /**在这一块**/
        if(this.freezeActive && active)
            this.yaw = this.pitch = 0;
        else
            this.Animate(cw, ch);
        /***Animate函数里面是运动计算公式,你需要调整的是在鼠标没有触发hover时也能保持动画不是freeze状态,具体代码你自己改吧***/
        active && (this.active = active).Draw(c);
    };

    reply
    0
  • Cancelreply