summaryrefslogtreecommitdiff
path: root/presentty
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2015-07-22 20:45:26 +0000
committerJames E. Blair <corvus@gnu.org>2015-07-25 09:12:20 -0700
commit0bc1f9f2d89fe269d6a07df42025826c288775f3 (patch)
tree37e42fb24664b00277b46ba31e4f8966d2288869 /presentty
parentff07c4700e19cd3197fd8bac1ab8346b18aaaf15 (diff)
Add a tilt transition
The tilt transition is like pan, only vertical instead of horizontal.
Diffstat (limited to 'presentty')
-rw-r--r--presentty/rst.py1
-rw-r--r--presentty/transition.py10
2 files changed, 11 insertions, 0 deletions
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)