Difference between revisions of "Animation"
(example for using the animation module) |
m (Text replacement - "<cmd>" to "{{cmd|") |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | < [[ | + | < [[Presentations]] | [[Presentation effects]] | [[RawSteps]] | [[SlideWithSteps]] | [[JavaScript]]> |
− | |||
− | |||
== Introduction == | == Introduction == | ||
Line 11: | Line 9: | ||
* (probably one day [[SVG]] will enable that too) | * (probably one day [[SVG]] will enable that too) | ||
− | The first alternative can be hardcoded, achieved with either some trickery ( | + | The first alternative can be hardcoded, achieved with either some trickery ({{cmd|dorecurse}} may sometimes help you) or with support of modules such as [[RawSteps]]. |
This page will mostly deal with <b>[[JavaScript]]</b> animations. | This page will mostly deal with <b>[[JavaScript]]</b> animations. | ||
Line 119: | Line 117: | ||
\setupinteraction[state=start] | \setupinteraction[state=start] | ||
− | \definepairedbox[animationtext][location=top,align=middle] | + | \definepairedbox[animationtext][location=top,align=middle,width=\textwidth] |
\starttext | \starttext | ||
Line 128: | Line 126: | ||
{\placeanimationtext{The letter c}{\externalfigure[dummy]}} | {\placeanimationtext{The letter c}{\externalfigure[dummy]}} | ||
{\placeanimationtext{The letter d}{\externalfigure[dummy]}} | {\placeanimationtext{The letter d}{\externalfigure[dummy]}} | ||
+ | \stopanimation | ||
+ | |||
+ | \stoptext | ||
+ | </texcode> | ||
+ | |||
+ | === Example with formulae === | ||
+ | <texcode> | ||
+ | \usemodule[animation] | ||
+ | |||
+ | \setuppapersize[S6][S6] | ||
+ | |||
+ | \setupinteraction[state=start] | ||
+ | |||
+ | \definepairedbox[animationtext][location=top,align=middle,width=\textwidth] | ||
+ | |||
+ | \starttext | ||
+ | |||
+ | \startanimation | ||
+ | {\placeanimationtext{Sine norm, and}{\startformula \int_{0}^{2\pi}\sin^2(x)dx = \stopformula}} | ||
+ | {\placeanimationtext{Cosine norm}{\startformula\int_{0}^{2\pi}\cos^2(x)dx = \stopformula}} | ||
+ | {\placeanimationtext{are equal}{\startformula = \pi. \stopformula}} | ||
\stopanimation | \stopanimation | ||
Latest revision as of 13:17, 9 August 2020
< Presentations | Presentation effects | RawSteps | SlideWithSteps | JavaScript>
Contents
Introduction
If you want to give some dynamics to your documents, there are essentially two possibilities to do so:
- making multiple pages and (quickly) browse through them
- using JavaScript
- using the animation module
- (probably one day SVG will enable that too)
The first alternative can be hardcoded, achieved with either some trickery (\dorecurse may sometimes help you) or with support of modules such as RawSteps.
This page will mostly deal with JavaScript animations.
An example
Suppose you have a presentation and you want the content of a slide to be gradually shown on the screen like in the next example:
Slide 1
If a chicken and a half lays an egg and a half in a day and a half, how many eggs can one chicken lay in one day?
Slide 2
If a chicken and a half lays an egg and a half in a day and a half, how many eggs can one chicken lay in one day? - What a stupid question! ONE, of course.
Slide 3
If a chicken and a half lays an egg and a half in a day and a half, how many eggs can one chicken lay in one day? - What a stupid question! ONE, of course. - Wrong! I'll give you one more try: how many eggs can one chicken lay in a day and a half?
Slide 4
If a chicken and a half lays an egg and a half in a day and a half, how many eggs can one chicken lay in one day? - What a stupid question! ONE, of course. - Wrong! I'll give you one more try: how many eggs can one chicken lay in a day and a half? - Wait a minute ... one chicken can lay 2/3 eggs in one day, doesn't it?
The difference in how the two mentioned method would deal with it:
- In the first case your document would consist of 4 pages with the corresponding content on each page.
- In the second case you would only have one page and some JavaScript code behind the scenes taking care of the content appearing gradually on your page as you click on some button.
Comparison
It all depends on your needs which of the two mentioned possibilities would suit you most. Here are some advantages and disadvanteges of both methods listed.
PROS | CONS | |
---|---|---|
Multiple pages |
|
|
JavaScript |
|
|
How to make movies?
Even if you were leaping for joy once you heard about the animations, I have to disappoint you right away: no matter how hard you try, it's not very likely that you'll ever achive much more than one, maybe some frames per second. So won't really be able to watch movies this way.
However, there's another possibility to use your nice metapost figures to make animations, pdf2swf. See http://melusine.eu.org/syracuse/metapost/animations/ and http://www.quiss.org/swftools/examples.html for examples.
Preparing the figures with Metapost/Metafun
JavaScript Animations
Animations in plain TeX
Animations in a pdfTeX-generated PDF
Examples
Using the animation module
Simple example
\usemodule[animation] \setupinteraction[state=start] \starttext \startanimation {\externalfigure[dummy]A} {\externalfigure[dummy]B} {\externalfigure[dummy]C} {\externalfigure[dummy]D} \stopanimation \stoptext
\usemodule[animation] \setupinteraction[state=start] \definepairedbox[animationtext][location=top,align=middle,width=\textwidth] \starttext \startanimation {\placeanimationtext{The letter a}{\externalfigure[dummy]}} {\placeanimationtext{The letter b}{\externalfigure[dummy]}} {\placeanimationtext{The letter c}{\externalfigure[dummy]}} {\placeanimationtext{The letter d}{\externalfigure[dummy]}} \stopanimation \stoptext
Example with formulae
\usemodule[animation] \setuppapersize[S6][S6] \setupinteraction[state=start] \definepairedbox[animationtext][location=top,align=middle,width=\textwidth] \starttext \startanimation {\placeanimationtext{Sine norm, and}{\startformula \int_{0}^{2\pi}\sin^2(x)dx = \stopformula}} {\placeanimationtext{Cosine norm}{\startformula\int_{0}^{2\pi}\cos^2(x)dx = \stopformula}} {\placeanimationtext{are equal}{\startformula = \pi. \stopformula}} \stopanimation \stoptext
Animating Text
TODO: presentations with pre-61
Making animations with external tools
Samples
- Gif Animation
- Flash Animations made with swftools
Documentation
- JavaScript (as well as PDF) reference at [Adobe]
TODO: Here are a lot of empty sections, and a bit more order won't hurt (See: To-Do List) |