I am using vue-konva with vuejs and I can't appy konva filters on my elements. I have implemented my component like this :
<template>
<div>
<v-stage ref="stage" :config="configKonva">
<v-layer ref="layer">
<v-image ref="maskelement" :config="imageConfig" />
<v-circle :config="configCircle"></v-circle>
</v-layer>
</v-stage>
</div>
</template>
<script>
export default {
name: 'mySvg',
data() {
const img = new Image();
img.src = 'myImagePath.png';
return {
configCircle: {
x: 500,
y: 200,
radius: 70,
fill: 'red',
stroke: 'pink',
strokeWidth: 4,
},
imageConfig: {
x: 0,
y: 0,
image: img,
width: 1181,
height: 1181,
filters: [
Konva.Filters.Mask,
],
threshold: 200,
},
};
},
};
</script>
I have also tryed to add a sceneFunc
attribute to imageConfig like this :
imageConfig: {
x: 0,
y: 0,
image: img,
width: 1181,
height: 1181,
sceneFunc: (context, elem) => {
elem.filters([Konva.Filters.Mask]);
elem.threshold(200);
},
},
But as soon as there is a sceneFunc
attribute, my component won't display
How should I use filters with vuejs?