Update 5: In newer versions (e.g., version 13.3.1) replace ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]]
below with
ImportString[ExportString[#, "PDF"], {"PDF", "PageGraphics"},
"TextMode" -> "Outlines"][[1, 1]]
Update 4: Rotations around x
axis followed by rotations around y
axis followed by rotations around z
axis:
faces = Polygon[#, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}] & /@
{{1, 2, 4, 3}, {1, 5, 6, 2}, {1, 3, 7, 5}, {8, 6, 5, 7}, {8, 7, 3, 4}, {8, 4, 2, 6}};
images = Import /@
{"https://images-na.ssl-images-amazon.com/images/I/51ZQiVNDYPL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51S7cvjbrqL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/61acUMNLNvL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51xRMocaTKL._SX425_.jpg"};
{one, six} = Texture[Graphics[
ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]],
Background -> #2]] & @@@ Transpose[{{"1", "6"}, {Red, Yellow}}];
textures2 = Join[Texture /@ images, {one, six}];
Animate[Graphics3D[
Rotate[GraphicsComplex[Tuples[{0, 1}, 3],Transpose[{textures2, faces}]], t,
IdentityMatrix[3][[1 + Quotient[t, 2 Pi]]], {1, 1, 1}/2],
Lighting -> "Neutral", SphericalRegion -> True,
PlotRange -> {{-1/2, 3/2}, {-1/2, 3/2}, {-1/2, 3/2}},
Boxed -> False], {t, Range[0, 6 Pi - Pi/120, Pi/120]}]
Update 3: Rotations by a random angle around a randomly selected axis:
Animate[Graphics3D[Rotate[GraphicsComplex[Tuples[{0, 1}, 3],
Transpose[{textures, faces}]], t, RandomChoice[IdentityMatrix[3]]],
Lighting -> "Neutral", SphericalRegion -> True, Boxed -> False],
{t, RandomSample[Range[0, 2 Pi, Pi/60]]}]
frames2 = Table[Graphics3D[
Rotate[GraphicsComplex[Tuples[{0, 1}, 3], Transpose[{textures, faces}]], t,
RandomChoice[IdentityMatrix[3]]], Lighting -> "Neutral",
SphericalRegion -> True, Boxed -> False],
{t, RandomSample[Range[0, 2 Pi, Pi/60]]}];
Export["cube2.gif", frames2]
Update 2: Rotating a cube with images on its faces:
faces = Polygon[#, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}] & /@
{{1, 2, 4, 3}, {1, 5, 6, 2}, {1, 3, 7, 5}, {8, 6, 5, 7}, {8, 7, 3, 4}, {8, 4, 2, 6}};
images = Import /@
{"https://images-na.ssl-images-amazon.com/images/I/51ZQiVNDYPL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51S7cvjbrqL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/61acUMNLNvL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51xRMocaTKL._SX425_.jpg"};
{one, six} = Texture[Graphics[
ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]],
Background -> #2]] & @@@ Transpose[{{"1", "6"}, {Red, Yellow}}];
textures2 = Join[Texture /@ images, {one, six}];
Animate[Graphics3D[
GraphicsComplex[Tuples[{0, 1}, 3], Transpose[{textures2, faces}]],
Lighting -> "Neutral",
ViewVector -> 6 { Cos[t], Sin[t], 3 Sin[t]/6 + 1/12},
SphericalRegion -> True], {t, 0, 2 Pi, Pi/60}]
You can control the speed using the second and third buttons.
See also: this answer by halirutan to a related question
Update: Using some of the images from the links in OP:
images = Import /@
{"https://images-na.ssl-images-amazon.com/images/I/51ZQiVNDYPL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51S7cvjbrqL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/61acUMNLNvL._SX425_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/51xRMocaTKL._SX425_.jpg"};
{one, six} = Texture[Graphics[
ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]],
Background -> #2]] & @@@ Transpose[{{"1", "6"}, {Red, Yellow}}];
Just wrap your images with Texture
(and add the missing 1
and 6
):
textures2 = Join[Texture /@ images, {one, six}];
frames = Table[Graphics3D[GraphicsComplex[Tuples[{0, 1}, 3],
Transpose[{RandomSample[textures2, 6], faces}]], Lighting -> "Neutral"], {30}];
ListAnimate[frames]
Original answer:
textures = Texture[Graphics[ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]],
Background -> #2]] & @@@
Transpose[{CharacterRange["A", "Z"], Hue[#/26] & /@ Range[26]}];
faces = Polygon[#, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}] & /@
{{1, 2, 4, 3}, {1, 5, 6, 2}, {1, 3, 7, 5}, {8, 6, 5, 7}, {8, 7, 3, 4}, {8, 4, 2, 6}};
frames = Table[Graphics3D[GraphicsComplex[Tuples[{0, 1}, 3],
Transpose[{RandomSample[textures, 6], faces}]], Lighting -> "Neutral"], {30}]
ListAnimate[frames]
Export["cube.gif", frames]