日历样式,想要啥样做啥样

2018-05-31 17:22:46 浏览数 (1)

如何做出自己喜欢的日历类型,感兴趣的话,可以做出来挂到家里的墙上,你妈喜欢啥样做一个,你爸喜欢啥样再做一个,哈哈~~~~

代码:

Manipulate[

Graphics[

Table[{Texture[textures[year, plotAll[[poly]]][[i]]],

EdgeForm[{Thick, Red}],

Polygon[faces[[poly, i]],

VertexTextureCoordinates -> vtc[[poly]]]}, {i, 1, 12}],

ImageSize -> {If[poly == 1, 1000, 1100], 430}],

{{year, 2015, "year" }, Range[2013, 2023]},

{{poly, 1, ""}, {1 -> "dodecahedron", 2 -> "rhombic dodecehadron"}},

ControlPlacement -> Top,

ContentSize -> {610, 480},

Initialization :> (

Quiet@Get["Calendar`"];

days = Table[Calendar`DayOfWeek[{2013, 9, i}], {i, 2, 8}];

daysab = {"M", "T", "W", "T", "F", "S", "S"};

months = {"January", "February", "March", "April", "May", "June",

"July", "August", "September", "October", "November",

"December"};

monthlength[year_, month_] :=

Module[{nd = 1}, While[Calendar`DateQ[{year, month, nd}], nd ];

nd - 1];

(*dodecahedron*)

netd = Flatten[Normal[PolyhedronData["Dodecahedron", "NetFaces"]]];

net1 = PolyhedronData["Dodecahedron", "NetFaces"];

net2 = net1[[1]] // N;

net3 = net1[[2, 1]];

faces1 = Map[net2[[#]] &, net3];

(*rhombic dodecahedron*)

net1B = PolyhedronData["RhombicDodecahedron", "NetFaces"];

net2B = net1B[[1]] // N;

net3B = {{3, 4, 1, 2}, {1, 4, 7, 5}, {7, 4, 6, 9}, {6, 8, 11,

9}, {11, 12, 10, 9}, {10, 12, 15, 13}, {15, 12, 14, 17}, {14,

16, 19, 17}, {19, 20, 18, 17}, {18, 20, 23, 21}, {23, 20, 22,

25}, {22, 24, 26, 25}};

faces2 = Map[net2B[[#]] &, net3B];

faces = {faces1, faces2};

vtc = {Table[{0.5, 0.5}

0.5 {Cos[2 Pi/5 (i - 1) - Pi/2 - Pi/5],

Sin[2 Pi/5 (i - 1) - Pi/2 - Pi/5]}, {i, 1, 5}], {{0,

0.5}, {0.5, 0.}, {1, 0.5}, {0.5, 1}}};

mont[year_, month_, font_, plot_] :=

Module[{tab,

pos = Position[days, Calendar`DayOfWeek[{year, month, 1}]][[1,

1]], mlength = monthlength[year, month],

monoz = Map[Style[#, font] &, months]},

tab =

Join[{Map[Style[#, font] &, daysab]},

Partition[

PadRight[

PadLeft[Map[Style[#, font] &, Range[mlength]],

mlength pos - 1, ""], 42, ""], 7]];

Graphics[{Table[

Text[tab[[i, j]], {j, (7 - i)}], {i, 1, 7}, {j, 1, 7}],

Text[monoz[[month]], {4, 7.5}]}, PlotRange -> plot,

ImageSize -> {280, 280}]];

textures[year_, plot_] :=

Table[mont[year, i, 18, plot], {i, 1, 12}];

plotAll = {{{-2, 10}, {-2, 10}}, {{-2.6, 10.1}, {-3.4, 10.}}};

polyname = {"Dodecahedron", "RhombicDodecahedron"})]

0 人点赞