---
layout: example.html
title: Layer Swipe (WebGL)
shortdesc: Cropping a WebGL tile layer
docs: >
The prerender
and postrender
events on a WebGL tile layer can be
used to manipulate the WebGL context before and after rendering. In this case, the
gl.scissor()
method is called to clip the top layer based on the position of a slider.
Note: This example is minimalist and works as there is only one WebGL layer rendered. That might works as well if the layers are drawn to different contexts. This does not apply to to several layers drawn to a single context, such as set with the 'className' property to 'canvas3d' on multiple layers. In such case, it's would be wise adapt your code using 'gl.clear' and other tweaks to the prerender/postrender event.
tags: "swipe, webgl" cloak: - key: get_your_own_D6rA4zTHduk6KOKTXzGB value: Get your own API key at https://www.maptiler.com/cloud/ ---