New in Wolfram
Mathematica
8: Enhanced 2D and 3D Graphics
◄
previous
|
next
►
Graphics & Visualization
Multiple Geometric Transformations on an Object
Apply multiple geometric transformations on a textured triangle to create a kaleidoscope.
In[1]:=
X
SeedRandom[232]; pattern = Image[ArrayPlot[Table[Evaluate[\!\( \*UnderoverscriptBox[\(\[Sum]\), \(i\), \(5\)]\(6\ Boole[ y > .25\ Sin[RandomReal[{ \*FractionBox[\(1\), \(5\)], 3}]\ x + RandomReal[2\ \[Pi]]] + i]\)\) + \!\( \*UnderoverscriptBox[\(\[Sum]\), \(i\), \(5\)]\(Boole[ x > .25\ Sin[RandomReal[{ \*FractionBox[\(1\), \(5\)], 3}]\ y + RandomReal[2\ \[Pi]]] + 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]
Out[1]=
In[2]:=
X
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 \[Pi] t)/3 + \[Pi]/2], Sin[(2 \[Pi] t)/3 + \[Pi]/2]}], {t, 0, 2}], Table[RotationTransform[(2 \[Pi] t)/3], {t, 0, 3}]]]}, ImageSize -> Medium], {t, 0, 2 \[Pi]}, AnimationRunning -> False, SaveDefinitions -> True]
Out[2]=
Play Animation
»
Stop Animation
»