首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VexFlow用光束渲染吉他标签,但我不想渲染树干

VexFlow用光束渲染吉他标签,但我不想渲染树干
EN

Stack Overflow用户
提问于 2022-04-15 07:48:44
回答 1查看 35关注 0票数 0

我的代码是:

代码语言:javascript
复制
const div = document.getElementById('mContainer');
        const renderer = new Renderer(div, Renderer.Backends.SVG);
        renderer.resize(380, 300);
        const context = renderer.getContext();

        const stave = new TabStave(0, 40, 320);
        stave.setContext(context).draw();
        const noteData = [
            // { keys: ['f/4'], duration: 'q' },
            { keys: ['f/4'], duration: '8' },
            { keys: ['e/4'], duration: '8' },
            { keys: ['d/4'], duration: '8' },
            { keys: ['c/4'], duration: '16' },
            { keys: ['c/4'], duration: '16' },
            { keys: ['c/5'], duration: '8' },
            { keys: ['b/4'], duration: '8' },
            { keys: ['c/5'], duration: '8' },
            { keys: ['c/5'], duration: '32' },
            { keys: ['c/5'], duration: '32' },
            { keys: ['b/4'], duration: '32' },
            { keys: ['f/4'], duration: '32' }
        ];

        function createNote(data) {
            const tabNode = new TabNote({
                ...data,
                positions: [{ str: 2, fret: 'x' }],
            }, true);
            // tabNode.render_options.draw_stem_through_stave = true;
            return tabNode;
        }

        // const formatter = new Formatter();
        const notes = noteData.map(createNote);
        const voice = new Voice({
            num_beats: 4,
            beat_value: 4,
        }).addTickables(notes);
        new Formatter().joinVoices([voice]).format([voice], 300);
        voice.draw(context, stave);
        const beams = Beam.generateBeams(notes, {
            stem_direction: Stem.DOWN,
        });
        beams.forEach((b) => {
            b.setContext(context).draw();
        });

结果是在这里输入图像描述

但我不想把最突出的部分

在这里输入图像描述

如果我关闭渲染阀杆

代码语言:javascript
复制
const tabNode = new TabNote({
                ...data,
                positions: [{ str: 2, fret: 'x' }],
            }, false);

呈现结果为false:在这里输入图像描述

那我该怎么纠正呢?

EN

回答 1

Stack Overflow用户

发布于 2022-04-19 02:59:01

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71881404

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档