ErasableLayer
what's?
It is a erasable cover that based is canvas,and you can simple to use it.
features
✨️ Friendly TypeScript
✨️ Vue3 Scripe Setup
✨️ Thin Size (6kb)
props & emits & instance
| props | type | default | desc |
|-------------|----------|------------|----------------------------------------------------------------------------------------------------------------------------|
| layerColor | string | gray | color of cover |
| over | number | 0.5 | clear cover when over. max value is 0.7 |
| renderLayer | function | / | custom cover render function.and
you need set
ctx.value.globalCompositeOperation = "destination-out"; in last |
| canvasId | string | __erasable | support from version
1.0.3 |
it emit a event entitle
done ,example:
>
it will be called when your erased area more than over value
you can use component instance to reset canvas, example:
``
vue
``
aursordev:😊 Enjoy it.