I have a GitLab repository where I have a lot of example usage of QGIS Geometry Generators. I added a new example to that repository.
The example style changes the border of polygons to a gradient. It uses a negative buffer to create the border, so this means the outside of the polygon remains the same. You could also make a double sided buffer, but that would change the outline of the polygon.
In QGIS 3.26 and later you can also animate this style.