微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 svgjs 库创建新的 svg 图“箭头”?

如何解决如何使用 svgjs 库创建新的 svg 图“箭头”?

我明白这是一个三角形和一条线,但如何描述呢?

以下是从文档中添加您自己的元素的简短示例。

SVG.Rounded = SVG.invent({
    // Define the type of element that should be created
    create: 'rect'

        // Specify from which existing class this shape inherits,inherit: SVG.Shape

        // Add custom methods to invented shape,extend: {
        // Create method to proportionally scale the rounded corners
        size: function(width,height) {
            return this.attr({
                width: width,height: height,rx: height / 5,ry: height / 5
            })
        }
    }

    // Add method to parent elements,construct: {
        // Create a rounded element
        rounded: function(width,height) {
            return this.put(new SVG.Rounded).size(width,height)
        }

    }
})

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。