Код: Выделить всё
createMask() {
// Fill the entire artboard with black
this.maskGraphics.clear()
this.maskGraphics.moveTo(0, 0)
this.maskGraphics.lineTo(this.artboardWidth, 0)
this.maskGraphics.lineTo(this.artboardWidth, this.artboardHeight)
this.maskGraphics.lineTo(0, this.artboardHeight)
this.maskGraphics.closePath()
this.maskGraphics.fill(hexToRGBA('#000000', 0.5))
// Create the polygon hole
const poly = new Graphics()
poly.moveTo(this.data.coords[0].x, this.data.coords[0].y)
for (let i = 1; i < this.data.coords.length; i++) {
poly.lineTo(this.data.coords[i].x, this.data.coords[i].y)
}
poly.closePath()
poly.fill('#ffffff')
poly.blendMode = 'erase'
// Add the polygon hole to the mask
this.maskGraphics.addChild(poly)
// Setup masked container
this.maskedPolyContainer.addChild(this.maskGraphics)
this.maskedPolyContainer.mask = poly
// Add to main container
this.container.addChild(this.maskedPolyContainer)
}
Я попробовал использовать blendMode = 'erase', но при этом стирается все, что находится под полигоном. Я не вижу актуального примера реализации групп рендеринга в версии 8.x.
Есть какие-нибудь советы, как это сделать?
Подробнее здесь: https://stackoverflow.com/questions/797 ... -beginhole
Мобильная версия