Applying different color to result of a geometric transformation
I don't think it is possible to do it as you'd like.
If you examine the FullForm
of the graphics made this way (changed a bit to shorten the output) you see the following:
Graphics[GeometricTransformation[Point[{0, 0}],
Table[RotationTransform[k], {k, 2}]]] // FullForm
(* ==>
Graphics[GeometricTransformation[Point[{0, 0}],
{TransformationFunction[
{{Cos[1], -Sin[1], 0}, {Sin[1], Cos[1], 0}, {0, 0, 1}}],
TransformationFunction[
{{Cos[2], -Sin[2], 0}, {Sin[2],Cos[2], 0}, {0, 0, 1}}]}]] *)
The Graphics
contains the whole GeometricTransformation
construction with only the Table
expanded. The implication of this is that GeometricTransformation
is a Graphics
primitive that is directly rendered by the FrontEnd without being translated into lower primitives. This is, of course, the reason why GeometricTransformation
can be very efficient to use. You can have a very complex graphics element and if you copy it, you only store the copy instructions and not as many copies of the complex element itself.
The disadvantage is what you have discovered, you can't change its color or opacity, as these properties are part of the single element's description. As far as I know, there is no Transform type for these properties.
Here is an alternative that tries to use the "listability" of Polygon
for both, the points and the colors.
The idea is that all individual polygons and their corresponding (different) colors can be provided as two single lists if we use VertexColors
:
Graphics@Polygon[#1, VertexColors -> #2] &[
Table[RotationTransform[
2 Pi k/6][{{0, 0}, {.2, .6}, {.8, .2}}], {k, 0, 5}],
Table[{#, #, #} &@Directive[Cyan, Opacity[.15 k]], {k, 0, 5}]]
Now although I have to supply two separate tables here, I at least need only one single Polygon
command. The separate tables aren't such a big problem, I think, because we have gained a simplification in the graphical part of the code (which is often the slowest).
And by using VertexColors
, I of course gain some new flexibility that you don't have if you add face colors the "old-fashioned" way. For example, one can do this with only a small modification of the code:
Graphics@Polygon[#1, VertexColors -> #2] &[
Table[RotationTransform[
2 Pi k/6][{{0, 0}, {.2, .6}, {.8, .2}}], {k, 0, 5}],
Table[Directive[Hue[#],
Opacity[.15 (k + 1)]] & /@ ({.1, .2, .3} (k + 1)), {k, 0, 5}]]