diff --git a/docs/developer-guide/custom-layers/subclassed-layers.md b/docs/developer-guide/custom-layers/subclassed-layers.md index 754354c3606..c5c142f8f87 100644 --- a/docs/developer-guide/custom-layers/subclassed-layers.md +++ b/docs/developer-guide/custom-layers/subclassed-layers.md @@ -12,13 +12,21 @@ good technique to add it. ```js // Example to add per-segment color to PathLayer import {PathLayer} from '@deck.gl/layers'; +import GL from '@luma.gl/constants'; // Allow accessor: `getColor` (Function, optional) // Returns an color (array of numbers, RGBA) or array of colors (array of arrays). export default class MultiColorPathLayer extends PathLayer { initializeState() { super.initializeState(); - this.getAttributeManager().getAttributes().instanceColors.update = this.calculateColors; + this.getAttributeManager().addInstanced({ + instanceColors: { + size: 4, + type: GL.UNSIGNED_BYTE, + normalized: true, + update: this.calculateColors + } + }) } calculateColors(attribute) {