See the Pen behavior-api-custom-example-9 by soritesparadox (@soritesparadox) on CodePen.