Simple drawing tool.
https://luna.liriliri.io/?path=/story/painter
Add the following script and style to your page.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-toolbar/luna-toolbar.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-painter/luna-painter.css" />
<script src="//cdn.jsdelivr.net/npm/luna-toolbar/luna-toolbar.js"></script>
<script src="//cdn.jsdelivr.net/npm/luna-painter/luna-painter.js"></script>
You can also get it on npm.
npm install luna-painter luna-toolbar --save
import 'luna-toolbar/luna-toolbar.css'
import 'luna-painter/luna-painter.css'
import LunaPainter from 'luna-painter'
const container = document.getElementById('container')
const painer = new LunaPainter(container)
- height(number): Canvas height.
- tool(string): Initial used tool.
- width(number): Canvas width.
Add layer.
Get active layer.
Get current tool name.
Get tool.
Use tool.