Using analogWrite on transistor(s)

One thing that can happen specifically with switching circuits is that during the switching the device temporarily is dissipating much more power than its steady-state power rating. However datasheets usually have a graph to show the safe limits for this. The slightly counter-intuitive thing is that switching the device faster (by driving its input harder) actually makes the device suffer less (less time in the switchover).