See the Pen ramp-cos-example by soritesparadox (@soritesparadox) on CodePen.