/usr/share/doc/hovercraft/examples/positions.rst is in hovercraft 2.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | :title: Positioning tutorial
:css: tutorial.css
This is a tutorial for Hovercraft! positioning. It's meant to be read as
`source code <../_sources/examples/positions.txt>`_.
You can render this presentation to HTML with the command::
hovercraft positions.rst outdir
And then view the outdir/index.html file to see how it turned out.
If you are seeing this text, and not reading this as source code, you are
doing it wrong! It's going to be confusing and not very useful.
Use The Source, Luke! But first you probably want to read through the
official documentation at https://hovercraft.readthedocs.org/
There are links to the source code in the Examples section.
----
Positions
=========
Each step can be explicitly positioned by putting some ``data-`` fields in
the beginning of the slide. This has to be first in the slide (although you
have to have a blank line beneath the four dashes that start the slide.
To put the slide at zero pixels to the right and a thousand pixels below the
coordinate centre you add the following::
:data-x: 0
:data-y: 1000
Let's do that for the next slide:
----
:data-x: 0
:data-y: 1000
X & Y
=====
You don't have to give both X and Y coordinates. They will default to "no
difference from the last slide" if not given. As the first slide ends up at
X=0 and Y=0, the ``:data-x: 0`` above is strictly speaking not necessary.
----
:data-x: 2000
:data-y: 1000
Positioning fields
==================
Any field starting with ``data-`` will be converted to a ``data-`` attribute
on the impress.js step. There is no filtering done, so if new attributes are
supported by impress.js, they should just work from Hovercraft! as well.
The ones impress.js currently uses are::
data-x Position on the X-axis
data-y Position on the Y-axis
data-z Position on the Z-axis (which means 3D!)
data-rotate Rotation in degrees
data-rotate-z An alias for data-rotate
data-rotate-x Rotation on the X-axis, which agains means 3D effects
data-rotate-y Rotation on the Y-axis
data-scale The size of the slide, which means zooming effects
Let's do some zoom and rotate!
----
:data-scale: 5
:data-rotate: 90
:data-x: 3000
:data-y: 1000
Zoom out!
=========
So here we rotated 90 degrees and zoomed out five times.
----
:data-scale: 1
:data-x: 4000
:data-y: 2000
Relative positions
==================
One thing that *is* a problem is the absolute positioning. All the positions
we used so far above are in relation to the start of the coordinate system.
But if we now need to insert a slide somewhere in between the slides above,
we need to make room for it, and that means we have to reposition all the
slides that come after. That quickly becomes annoying.
Hovercraft! therefore supports relative positioning where you just give a
relative coordinate to the last slide.
----
:data-x: r1000
Like this
=========
You just prefix the position with an ``r`` and it becomes relative. That
means that if the previous slide moves, this moves with it. You'll find that
it's generally good practice to use mostly relative positioning if you are
still flexible about what your slides are and what they should say or
in which order.
For some types of presentation, where typography is important, you need to
decide everything that the slide should say and their position from the
start. Then absolute positioning works fine. But otherwise you probably want
to use relative positioning.
----
:data-rotate: r15
Automatic positioning
=====================
Every field will retain it's last value if you don't specify a new one.
In this case, we keep a r1000 value for data-x and introduce a new
r15 value for data-rotate. This and the next slide will therefore
move right 1000 pixels and rotate 15 degrees more for each slide.
It looks like it moves "up" because we are already rotated 90 degrees.
----
:data-scale: 0.15
**A warning!**
==============
----
:data-x: r1000
:data-scale: 1
Didn't that slide look good?
============================
Don't worry, when you make big zooms, different browsers will behave
differently and be good at different things. Some will be slow and jerky on
the 3D effects, and others will show fonts with jagged edges when you zoom.
Older and less common browsers can also have problems with 3D effects.
----
:hovercraft-path: m275,175 a150,150 0 0,1 -150,150
SVG paths
=========
The field ``:hovercraft-path:`` tells Hovercraft! to place the slides
along a SVG path. This enables you to put slides along a graphical shape.
----
SVG paths
=========
You can design the shape in a vector graphics program like Inkscape
and then lift it out of the SVG file (which are in XML) and use it
in Hovercraft!
This example is an arc.
----
SVG paths
=========
Using SVG path so is not entirely without it's difficulties and
surprises, and this is discussed more in the documentation, under
the SVG Paths heading.
----
SVG paths
=========
Every following slide will be placed along the path,
and the path will be scaled to fit the slides.
----
:data-rotate: -180
:data-x: r-1200
SVG paths
=========
And the positioning along the path will end when you get a path that has
explicit positioning, like this one.
----
:data-rotate-y: -45
:data-y: r-100
:data-x: r-800
3D!
===
Now it get's complicated!
----
:data-rotate-y: 0
:data-y: r100
:data-x: r-1000
3D Rotation
===========
We have already seen how we can rotate the slide with ``:data-rotate:``. This is actually rotation
in the Z-axis, so you can use ``:data-rotate-z:`` as well, it's the same thing.
But you can also rotate in the Y-axis.
----
:data-x: r0
:data-y: r0
:data-rotate-y: 90
3D Rotation
===========
That was a 90 degree rotation in the Y-axis.
Let's go back.
----
:data-x: r0
:data-y: r0
:data-rotate-y: 0
----
:data-x: r-1000
:data-y: r0
:data-rotate-y: 0
3D Rotation
===========
Notice how the text was invisible before the rotation?
The text is there, but it has no depth, so you can't see it.
Of course, the same happens in the X-axis.
----
:data-x: r0
:data-y: r0
:data-rotate-x: 90
3D Rotation
===========
That was a 90 degree rotation in the X-axis.
Let's go back.
----
:data-x: r0
:data-y: r0
:data-rotate-x: 0
----
:data-x: r-1000
3D Positioning
==============
You can not only rotate in all three dimensions, but also position in all
three dimensions. So far we have only used ``:data-x`` and ``:data-y``, but
there is a ``:data-z`` as well.
----
:data-z: 1000
:data-x: r0
:data-y: r-50
Z-space
=======
----
:data-x: r0
:data-y: r-500
Z-space
=======
This can be used for all sorts of interesting effects. It should be noted
that the depth of the Z-axis is quite limited in some browsers.
If you set it too high, you'll find the slide appearing low and upside down.
----
:data-x: r800
:data-y: r0
Z-space
=======
But well used it can give an extra wow-factor,
----
:data-z: 0
:data-x: r100
:data-y: r-200
:data-scale: 1
and make text pop!
==================
----
:data-x: r3000
:data-y: r-1500
:data-scale: 15
:data-rotate-z: 0
:data-rotate-x: 0
:data-rotate-y: 0
:data-z: 0
That's all for now
==================
*Have fun!*
|