summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example/demo.rst17
-rw-r--r--presentty/rst.py1
-rw-r--r--presentty/transition.py10
3 files changed, 23 insertions, 5 deletions
diff --git a/example/demo.rst b/example/demo.rst
index bafd9ba..c105e7d 100644
--- a/example/demo.rst
+++ b/example/demo.rst
@@ -2,11 +2,11 @@
2 The following directives, when used at the top of the file, set default 2 The following directives, when used at the top of the file, set default
3 values for all slides: 3 values for all slides:
4 4
5 This sets the transition style. Values are: 'dissolve', 'pan', or 5 This sets the transition style. Values are: 'dissolve', 'pan',
6 'cut'. The optional argument of 'duration' sets the duration of 6 'tilt', or 'cut'. The optional argument of 'duration' sets the
7 the transition in seconds (0.4 seconds by default). The same 7 duration of the transition in seconds (0.4 seconds by default).
8 syntax may be used within a slide to override the transition for 8 The same syntax may be used within a slide to override thes
9 that slide alone. 9 transition for that slide alone.
10 10
11 .. transition:: dissolve 11 .. transition:: dissolve
12 :duration: 0.4 12 :duration: 0.4
@@ -77,6 +77,13 @@ Pan Transition
77...or "pan," where the slides appear horizontally adjacent and move 77...or "pan," where the slides appear horizontally adjacent and move
78right to left... 78right to left...
79 79
80Tilt Transition
81===============
82.. transition:: tilt
83
84...or "tilt," where the slides appear vertically adjacent and move
85bottom to top...
86
80Cut Transition 87Cut Transition
81============== 88==============
82.. transition:: cut 89.. transition:: cut
diff --git a/presentty/rst.py b/presentty/rst.py
index e96ff21..ab06f76 100644
--- a/presentty/rst.py
+++ b/presentty/rst.py
@@ -65,6 +65,7 @@ class UrwidTranslator(docutils.nodes.GenericNodeVisitor):
65 transition_map = {'dissolve': transition_mod.DissolveTransition, 65 transition_map = {'dissolve': transition_mod.DissolveTransition,
66 'cut': transition_mod.CutTransition, 66 'cut': transition_mod.CutTransition,
67 'pan': transition_mod.PanTransition, 67 'pan': transition_mod.PanTransition,
68 'tilt': transition_mod.TiltTransition,
68 } 69 }
69 70
70 def __init__(self, document, palette, hinter=None, basedir='.'): 71 def __init__(self, document, palette, hinter=None, basedir='.'):
diff --git a/presentty/transition.py b/presentty/transition.py
index c699ddb..5592cd9 100644
--- a/presentty/transition.py
+++ b/presentty/transition.py
@@ -46,6 +46,16 @@ class PanTransition(Transition):
46 c.pad_trim_left_right(0-offset, 0-(size[0]-offset)) 46 c.pad_trim_left_right(0-offset, 0-(size[0]-offset))
47 return c 47 return c
48 48
49class TiltTransition(Transition):
50 def render(self, size, focus=False):
51 old = self.old.render((size[0], size[1]))
52 new = self.new.render((size[0], size[1]))
53 c = urwid.CanvasCombine([(old, None, False),
54 (new, None, False)])
55 offset = int(size[1] * self.progress)
56 c.pad_trim_top_bottom(0-offset, 0-(size[1]-offset))
57 return c
58
49class DissolveTransition(Transition): 59class DissolveTransition(Transition):
50 def __init__(self, *args, **kw): 60 def __init__(self, *args, **kw):
51 super(DissolveTransition, self).__init__(*args, **kw) 61 super(DissolveTransition, self).__init__(*args, **kw)