3
$\begingroup$

The first I am trying to export animations from Mathematica to a file and then to LaTeX. Don't assume I know anything about what I'm doing.

The following definitions defines the still image of a single frame. It is a stick of length $k$ that has two pivot points: one sliding along $x$-axis, $\{\cos u,0\}$, and the other, along the $y$-axis. $\{0,\sin u\}$, so the distance between the two pivots is always equal to $1$ irrespective of the value of the parameter $u$. One end of the stick is at the $y$-axis pivot, and the other is determined by the length of the stick. That other endpoint draws an ellipse, as $u$ increases from $0$ to $2\pi$.

tikku[u_, k_] := 
 Show[{ParametricPlot[{k Cos[x], (1 - k) Sin[x]}, {x, 0, u}], 
   Graphics[{Line[{{k Cos[u] + 0.05 Sin[u], (1 - k) Sin[u] + 
         0.05 Cos[u]}, {0.05 Sin[u], 
        Sin[u] + 0.05 Cos[u]}, {-0.05 Sin[u], 
        Sin[u] - 0.05 Cos[u]}, {k Cos[u] - 
         0.05 Sin[u], (1 - k) Sin[u] - 0.05 Cos[u]}, {k Cos[u] + 
         0.05 Sin[u], (1 - k) Sin[u] + 0.05 Cos[u]}}]}], 
   Graphics[{PointSize[0.02], {Point[{Cos[u], 0}], 
      Point[{0, Sin[u]}]}}]}, PlotRange -> {{-2.2, 2.2}, {-1.2, 1.2}},
   AspectRatio -> Automatic, AxesOrigin -> {0, 0}, Axes -> True]

Then I create an animation with

movie = Animate[tikku[u, 1.8], {u, 0, 2 Pi}, Alignment -> Center]

That is displayed as expected. But when I export that file with the command

Export["Analyysi I/2013/ellipsi.swf", movie]

and open the resulting .swf file with Adobe Reader I get the following error message (my translation from Finnish): "Adobe Reader couldn't open the file "ellipsi.swf", because it is of an unsupported type...."

I can open the .swf-file in IE. If I export the animation as an .avi-file instead, then I can also view it in Windows Media Player. However, something seems to have gone wrong while exporting, because at the beginning (and also at the end) a frame with Mathematica code is shown instead of the first frame of the animation.

Questions:

  1. What should I do to make it viewable in Adobe Reader? (I just installed flashplayer, but that didn't help) This is kinda crucial for including the animation to a slide set produced by LaTeX.
  2. What should I do to get rid of that extraneous first frame?
$\endgroup$
6
  • 1
    $\begingroup$ I didn't think Adobe Reader could open Flash files... Are you sure that what you want to do is possible? $\endgroup$
    – cormullion
    Commented Nov 25, 2013 at 16:11
  • $\begingroup$ @cormullion: No, I'm not sure. But embedding the resulting .swf to a .pdf- document produced by LaTeX should be possible according to the documentation of a package called media9. My attempts to do that have failed, and I felt that something might be wrong with the .swf-file. It is quite possible that I am wrong. $\endgroup$ Commented Nov 25, 2013 at 17:08
  • 2
    $\begingroup$ To see why you get that Mathematica code, try calling your function as tikku[0.0,1.8] and you'll get error messages. I actually got a much better animation using movie2=Table[tikku[u,1.8],{u,0.01,2.0 Pi,Pi/32.0}];Export["test2.swf",movie2]; That answers your question 2), but about question 1) I'm not sure. To narrow down the problem, you should download an SWF file not created by Mathematica from the web and try to embed it in a pdf. If that works and plays properly, then we can try to figure out what is different about Mathematica-generated SWF files. $\endgroup$
    – Jason B.
    Commented Nov 25, 2013 at 17:28
  • 1
    $\begingroup$ After a bit of googling I learn (to my horror:)) that it is possible to embed SWF inside a PDF and then view the PDF in Adobe reader. But there are all kinds of issues with security and then I stopped reading so this is where I must bow out of the question... Good luck! $\endgroup$
    – cormullion
    Commented Nov 25, 2013 at 17:36
  • $\begingroup$ Thanks, @Jason. <insert blush emoticon> That was silly of me. I added the ParametricPlot later, and didn't test it. Of course, in Mathematica the error message flashes out so fast, but I keep seeing the errorneous frame in animation. $\endgroup$ Commented Nov 25, 2013 at 18:06

1 Answer 1

4
$\begingroup$

The problem is resolved. Here's what had happened. The drawing of that initial segment of the arc of an ellipse by ParametricPlot caused an error in the first frame answering question 2. (Thanks, Jason!). Starting the range of the drawing parameter from -0.01 instead of 0 is enough to fix this.

My suspicion that an error in SWF-file produced the strange looking TeX (powerdot) slide set turned out to be unfounded. The SWF-file is actually ok. But because of that errorneous first frame the Mathematica animation box was not centered in the movie screen. When I zoomed in to the animation in Adobe Reader, the moving stick suddenly became partly visible. The bounding box (or whatever) was just so out of whack that in normal view it was out of sight. I tested this again with the corrected animation, and now it looks quite good.

TL;DR; False alarm. Sorry Thanks, guys!

$\endgroup$
1
  • $\begingroup$ Accepting this to let the question drift to the background. My learning process continued in this question. Thanks all, once more! $\endgroup$ Commented Dec 22, 2013 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.