前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >日历样式,想要啥样做啥样

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

作者头像
WolframChina
发布2018-05-31 17:22:46
5540
发布2018-05-31 17:22:46
举报
文章被收录于专栏:WOLFRAMWOLFRAM

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

代码:

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"})]

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2015-02-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WOLFRAM 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档