Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mathematica:coverflow
pic = Import["ExampleData/rose.gif"];
Module[{width = 28, layers = 6, offset, highlight, slides, img,
data},
offset[x_, slide_] := 15/(1 + Exp[-(x - slide) 3]);
highlight[x_, slide_] :=
0.85 PDF[NormalDistribution[slide, 1], x]/
PDF[NormalDistribution[slide, 1], slide] + 0.15;
img = Table[pic, {n, 1, layers}];
Manipulate[Graphics3D[{
Table[{
Texture[img[[n]]],
Opacity[highlight[n, slide]],
Text[
Style[n, 16], {n + offset[n, slide], -width/2 + 1,
width/2 - 1}],
Polygon[{
{n + offset[n, slide], -width/2, width/2},
{n + offset[n, slide], -width/2, -width/2},
{n + offset[n, slide], width/2, -width/2},
{n + offset[n, slide], width/2, width/2}},
VertexTextureCoordinates -> {{0, 1}, {0, 0}, {1, 0}, {1, 1}}]
},
{n, 1, layers}]},
PlotRange -> {{-1, layers + 20}, {-width/2 - 1,
width/2 + 1}, {-width/2, width/2 + 3}},
Lighting -> {{"Ambient", White}},
Background -> Black,
ViewPoint -> {1, -1.5, .5},
Axes -> None,
Boxed -> False,
ImageSize -> 700],
{{slide, layers + 2, "Slide"}, layers + 2, -3,
ControlType -> Slider, ImageSize -> 500}, SaveDefinitions -> True]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.