Government types tend to want a button for everything, and I try to dissuade them from that as much as possible. However, getting a Mapbox GL JS map to do the tilter-whirl thing requires a complex UI interaction. A little help is in order.
Tom MacWright has a good blog post to get you started. Your JavaScript class will require onAdd and onRemove events, which fire when the control is added to or removed from the map. If you want the control to look like the regular GL JS buttons, you’ll need to add the corresponding classes to your container and button.
In an ES6 class, class declarations via constructor let you set configurable values used by the rest of the class. Here we’re setting default values for pitch and bearing, and the minpitchzoom sets a minimum zoom when switching to 3D so the citizens won’t have a building footprint flying up their arse unexpectedly.
The code is on Github. Note as I’m using a few ES6 features, you’ll want to run it through something like Babel. If that isn’t a part of your build process already, it really should be.