https://github.com/freeshineit/svgjs
svgjs
https://github.com/freeshineit/svgjs
svg
Last synced: 7 months ago
JSON representation
svgjs
- Host: GitHub
- URL: https://github.com/freeshineit/svgjs
- Owner: freeshineit
- License: mit
- Created: 2017-04-10T08:18:45.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-02-28T14:58:56.000Z (over 2 years ago)
- Last Synced: 2025-01-13T20:25:54.447Z (9 months ago)
- Topics: svg
- Language: HTML
- Homepage:
- Size: 224 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Svg Demo
## Use
```bash
#
yarn install# development
yarn run dev# production
yarn run build# https://github.com/http-party/http-server
# version >= 14
cd docs && http-server -p 8080 .```
## svg element
```xml
圆
椭圆
线
矩形
文本
多边形 (多个点组成的封闭多边形)
路径(这个比较难,一般都是由设计师画好生成的)
```
## svg.js
```ts
import { SVG } from "@svgdotjs/svg.js";const draw = SVG().addTo("body").size(300, 300);
```
### rect```ts
// Container.rect(width?: number, height?: number): Rect
draw.rect(100, 100)
.fill("red") // fill 填充颜色
.attr({// 属性
x: 100, // x轴位置
y: 100 // y轴位置
});
```### circle
### line
### text