[Baard Kolstad]"Is there any way to key a gradient in after effects, so that it goes from 0% on one color to 100% on another color from an imported PNG? So in the middle of the shape it would be 50% opacity. "
you can create a luma matte out of this layer. apply the black and white effect and adjust the parameters until you get this:
now the original image can use this layer as a luma matte. the white will be opaque, the black will be transparent