Use Geometric Transformations to Create a Kaleidoscope
Use Geometric Transformations to Create a Kaleidoscope
Apply multiple geometric transformations on a textured triangle to create a kaleidoscope.
SeedRandom[232];pattern = Image[ArrayPlot[Table[Evaluate[Underoverscript[∑, i, 5]6 Boole[y > .25 Sin[RandomReal[{(1/5), 3}] x + RandomReal[2 π]] + i] + Underoverscript[∑, i, 5]Boole[x > .25 Sin[RandomReal[{(1/5), 3}] y + RandomReal[2 π]] + i]], {x, 0, 6, 1 / 50}, {y, 0, 6, 1 / 50}], ColorRules -> MapIndexed[First[#2] -> #1&, RandomChoice[ColorData[35, "ColorList"], 36]], PixelConstrained -> True, Frame -> False, PlotRangePadding -> None], ImageSize -> Automatic]Animate[Graphics[{Texture[ImageRotate[pattern, t, Floor[1 / Sqrt[2] ImageDimensions[pattern]]]], GeometricTransformation[Polygon[{{0, 0}, {1, 0}, {1 / 2, Sqrt[3] / 2}}, VertexTextureCoordinates -> {{1 / 2, Sqrt[3] / 2}, {0, 0}, {1, 0}}], Join[Table[ReflectionTransform[{Cos[(2 π t) / 3 + π / 2], Sin[(2 π t) / 3 + π / 2]}], {t, 0, 2}], Table[RotationTransform[(2 π t) / 3], {t, 0, 3}]]]}, ImageSize -> Medium], {t, 0, 2 π}, AnimationRunning -> False, SaveDefinitions -> True]