Dynamic Textures on Graphics Primitives
Dynamic Textures on Graphics Primitives
Any expression, including a dynamic object, can be used as a texture.
vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
coords = {{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}}, {{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}, {{1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}}, {{0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}}, {{0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}}};DynamicModule[{}, Graphics3D[{Dynamic[Texture[clock], UpdateInterval -> 1], Polygon[coords, VertexTextureCoordinates -> Table[vtc, {6}]]}, Lighting -> "Neutral", Boxed -> False], Initialization :> (clock := Module[{hour, min, sec, ht, mt, st}, {hour, min, sec} = Take[DateList[], -3];ht = (π/2) - (hour π/6) - (min π/360);mt = (π/2) - (min π/30);st = (π/2) - (π/30) Floor[sec];Graphics[{AbsoluteThickness[5], Arrowheads[Large], Arrow[{{0, 0}, 0.6 {Cos[ht], Sin[ht]}}], Arrow[{{0, 0}, 0.9 {Cos[mt], Sin[mt]}}], PointSize[Large], Table[Point[0.9 {Cos[i], Sin[i]}], {i, 0, 2 π, (π/6)}], Point[{0, 0}], Circle[], Red, Line[{{0, 0}, 0.85 {Cos[st], Sin[st]}}]}, ImageSize -> 500]])]