mma动图训练

Mathematica小测试

一个傅里叶变换动图

FourierF[a_, t_] := a.Table[Sin[2 Pi i t], {i, Length[a]}];
FourierAnim[a_, t_] := Module[{A=Accumulate[a*Table[Cos[2 Pi i t],i,Length[a]}]],
B=Accumulate[a*Table[Sin[2 Pi i t],{i,Length[a]}]]},rependTo[A,0];PrependTo[B, 0];
Show[Graphics[
     Table[{Circle[{A[[i]],B[[i]]},a[[i]]],Darker[Red],
       If[i != Length@a,Line[{{A[[i]], B[[i]]}, {A[[i + 1]], B[[i + 1]]}}], 
       {Red,Dashed, Line[{{A[[i]],B[[i]]},{2,B[[i]]}}]}]},{i,Length@a}],
       PlotRange -> {{-1.5, 3}, {-1, 1}}],
       Plot[FourierF[a[[;; -2]], t - \[Tau]], {\[Tau], 2, 3}]]];

a = Table[(1 - (-1)^i)/i, {i, 16}]/Pi;

Manipulate[FourierAnim[a[[;; j]], t], {t, 0, 1}, {j, 1, Length@a, 1}]

下面是代码截图:
GVIdGn.png
最终实现的效果如下:

GVRg5q.gif

其他

下面是插入视频测试。

  1. 利用iframe标签插入,适当调节大小:
<iframe height=300 width=600 
src="//player.bilibili.com/player.html?aid=88296129&bvid=BV1R741157BP&cid=150838565&page=1" 
scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
  1. 设置视频自适应
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
<iframe src="//player.bilibili.com/player.html?aid=88296129&bvid=BV1R741157BP&cid=150838565&page=1"  scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"></iframe>
</div>

显然第二种插入比第一种好,以后就用第二种了。

#

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×