Happy Star Wars day. I was playing around with the image manipulation functions in Mathematica in an attempt to recreate the Star Wars crawl. There's an HTML/CSS implementation which is in my opinion pretty impressive and I'm wondering if it's possible to obtain the same quality out of Mathematica (ideally using features that can be exported as a CDF).
For starters, I was focusing on the crawl (with the "long time ago..." and diminishing Star Wars title components to be added eventually). The text and theme song:
text = "It is a period of civil war.
Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.\n
During the battle, Rebel
spies managed to steal secret
plans to the Empire's
ultimate weapon, the DEATH
STAR, an armored space
station with enough power
to destroy an entire planet.\n
Pursued by the Empire's
sinister agents, Princess
Leia races home aboard her
starship, custodian of the
stolen plans that can save her
people and restore
freedom to the galaxy....";
theme = Import[
"http://www.moviewavs.com/0093058674/WAVS/Movies/Star_Wars/starwars.wav"]
One can get the gist if the effect fairly succinctly with a combination of ImagePerspectiveTransformation
and TranslationTransform
after rasterizing the text:
i0 = Rasterize[Panel[Style[text, Yellow], Background -> Black],
RasterSize -> 400, ImageSize -> 300];
Animate[
Show[With[{a = 5.25, b = 5},
ImagePerspectiveTransformation[
ImagePerspectiveTransformation[i0,
TranslationTransform[{0, crawl}]], {{1, 0.5 b, 0}, {0, a, 0}, {0,
b, 1.}}, PlotRange -> All]
], ImageSize -> 600],
{crawl, -3, 1}, AnimationRate -> 0.075, AnimationRepetitions -> 1,
Initialization -> (EmitSound@theme)]
There are some problems with this approach, however:
- Text quality isn't great. The quality can be improved by adjusting the Rasterize options; however I noticed a significant performance hit in doing so.
- The transformations result in white bars above and below the crawl.
- The theme song repeats and is not easily stoppable.
- The notebook size bloats to 2 MB even with the low res settings
- Use of Animate won't work when it comes to exporting as a CDF
I am interested in finding solutions to these problems.