Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scale[shape_, t_] := Module[{faces = PolyhedronData[shape, "Faces"]},
- faces[[1]] = Map[t, faces[[1]]];
- faces
- ];
- scaleV[shape_, t_] :=
- Module[{coords = PolyhedronData[shape, "VertexCoordinates"]},
- Map[t, coords]
- ];
- fade[a_, t_] := (Tanh[10 (t - a)] + 1)/2;
- frame[t_] :=
- Graphics3D[{
- Opacity[If[t < 0.45, 1 - fade[0.2, t]/2, 1 - fade[0.45, t]]], Red,
- If[t < 0.77, scale["Cube", # &], Opacity[1]],
- Opacity[1 - fade[0.5, t]/2], Blue,
- If[t < 0.8, Sphere[{0, 0, 0}, 1/2], Opacity[1]],
- Opacity[fade[0.4, t]], Green,
- If[t < 1.1, Point[scaleV["Octahedron", #/Sqrt[2] &]], Opacity[1]],
- Opacity[If[t < 1.1, 1 - fade[0.8, t]/2, 1 - fade[1.1, t]]],
- If[t < 1.2, scale["Octahedron", #/Sqrt[2] &], Opacity[1]],
- Opacity[fade[1, t]], Blue,
- Opacity[1 - fade[1.4, t]],
- Sphere[{0, 0, 0}, 1/(2 Sqrt[3])],
- Opacity[1],
- Red,
- Opacity[fade[0.84, t]],
- Point[scaleV["Cube", #/3 &]],
- Opacity[1],
- scale["Cube", #*
- If[t < 1.6, 1/3, If[t < 2, 1/3 + 5/3 (t - 1.6), 1]] &]
- }
- , Boxed -> False,
- PlotRange -> {{-0.6, 0.6}, {-0.6, 0.6}, {-0.6, 0.6}},
- ViewPoint -> {3 Sin[t Pi/4], 3 Cos[t Pi/4], 2}];
- Manipulate[frame[t], {t, 0, 2}]
Advertisement
Add Comment
Please, Sign In to add comment