~luisbg/flickbook/trunk

« back to all changes in this revision

Viewing changes to src/flickroll/modes.py

  • Committer: Luis de Bethencourt
  • Date: 2008-03-05 10:26:53 UTC
  • Revision ID: bethencourt@gmail.com-20080305102653-kcy9le0jy6gm2834
glitch fixed in all behaviors

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.timeOpDown.set_speed(fps)
58
58
 
59
59
    def disconnect(self, timeline):
60
 
        timeline.disconnect(self.cinUp)
 
60
        timeline.disconnect(self.cin)
 
61
        self.timeOp_black.disconnect(self.cinUp)
61
62
        self.timeOpUp.disconnect(self.cinDown)
62
63
 
63
64
class Rotate():
64
65
    def __init__(self, timeline, fps, image):
65
 
        self.timeOpA = clutter.Timeline(185, fps)
 
66
        self.timeOp_black = clutter.Timeline(5, fps)
 
67
        self.timeOpA = clutter.Timeline(180, fps)
66
68
        self.timeOpB = clutter.Timeline(15, fps)
67
 
        self.cin1 = timeline.connect("started", self.timeOpA_start)
 
69
        self.cin = timeline.connect("started", self.timeOp_black_start, image)
 
70
        self.cin1 = self.timeOp_black.connect("completed", self.timeOpA_start, image)
68
71
        self.cin2 = self.timeOpA.connect("completed", self.timeOpB_start)
69
72
 
70
73
        alphaDepth = clutter.Alpha(timeline, clutter.ramp_inc_func)
82
85
        self.opacityUp.apply(image)
83
86
        self.opacityDown.apply(image)
84
87
 
85
 
    def timeOpA_start(self, data):
 
88
    def timeOp_black_start(self, data, image): 
 
89
        image.hide()
 
90
        self.timeOp_black.start()
 
91
 
 
92
    def timeOpA_start(self, data, image):
 
93
        image.show()
86
94
        self.timeOpA.start()
87
95
        self.timeOpB.rewind()
88
96
 
95
103
        self.timeOpB.set_speed(fps)
96
104
 
97
105
    def disconnect(self, timeline):
98
 
        timeline.disconnect(self.cin1)
 
106
        timeline.disconnect(self.cin)
 
107
        self.timeOp_black.disconnect(self.cin1)
99
108
        self.timeOpA.disconnect(self.cin2)
100
109
 
101
110
class Scroll():
102
111
    def __init__(self, timeline, fps, image, x_pos):
 
112
        self.timeOp_black = clutter.Timeline(5, fps)
103
113
        self.timeOpA = clutter.Timeline(150, fps)
104
 
        self.timeOpB = clutter.Timeline(50, fps)
105
 
        self.cin1 = timeline.connect("started", self.timeOpA_start)
 
114
        self.timeOpB = clutter.Timeline(45, fps)
 
115
        self.cin = timeline.connect("started", self.timeOp_black_start, image)
 
116
        self.cin1 = self.timeOp_black.connect("completed", self.timeOpA_start, image)
106
117
        self.cin2 = self.timeOpA.connect("completed", self.timeOpB_start)
107
118
 
108
119
        alphaOpacity = clutter.Alpha(self.timeOpA, clutter.sine_inc_func)
121
132
        self.path.apply(image)
122
133
        self.opacityUp.apply(image)
123
134
        self.opacityDown.apply(image)
 
135
    
 
136
    def timeOp_black_start(self, data, image):
 
137
        image.hide()
 
138
        self.timeOp_black.start()
124
139
 
125
 
    def timeOpA_start(self, data):
 
140
    def timeOpA_start(self, data, image):
 
141
        image.show()
126
142
        self.timeOpA.start()
127
143
        self.timeOpB.rewind()
128
144
 
135
151
        self.timeOpB.set_speed(fps)
136
152
 
137
153
    def disconnect(self, timeline):
138
 
        timeline.disconnect(self.cin1)
 
154
        timeline.disconnect(self.cin)
 
155
        self.timeOp_black.disconnect(self.cin1)
139
156
        self.timeOpA.disconnect(self.cin2)
140
157
 
141
158
class SlideText():
154
171
        self.label.set_color(clutter.Color(200, 200, 200))
155
172
        self.label.set_opacity(0)
156
173
 
 
174
        self.timeOp_black = clutter.Timeline(5, fps)
157
175
        self.timeOpA = clutter.Timeline(150, fps)
158
 
        self.timeOpB = clutter.Timeline(50, fps)
159
 
        self.cin1 = timeline.connect("started", self.timeline_start)
 
176
        self.timeOpB = clutter.Timeline(45, fps)
 
177
        self.cin = timeline.connect("started", self.timeOp_black_start, image)
 
178
        self.cin1 = self.timeOp_black.connect("completed", self.timeline_start, image)
160
179
        self.cin2 = self.timeOpA.connect("completed", self.timeOpB_start)
161
180
 
162
181
        alphaDepth = clutter.Alpha(timeline, clutter.ramp_inc_func)
171
190
        self.opacityDown.apply(image)
172
191
 
173
192
        self.timeline = clutter.Timeline(200, fps)
174
 
        self.cin = timeline.connect("started", self.timeline_start)
 
193
        self.cin_label = timeline.connect("started", self.timeline_start, image)
175
194
 
176
195
        alphaOpacity = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
177
196
        self.opacity = clutter.BehaviourOpacity(alphaOpacity, 0, 255)
178
197
 
179
198
        self.opacity.apply(self.label)
180
199
 
181
 
    def timeline_start(self, data):
 
200
    def timeOp_black_start(self, data, image):
 
201
        image.hide()
 
202
        self.timeOp_black.start()
 
203
 
 
204
    def timeline_start(self, data, image):
 
205
        image.show()
182
206
        self.label.set_text(self.lines[random.randint(0, len(self.lines) -1)])
183
207
        self.label.set_opacity(0)
184
208
        self.label.set_position(random.randint(0, 600), random.randint(0, 400))
200
224
 
201
225
    def disconnect(self, timeline):
202
226
        timeline.disconnect(self.cin)
203
 
        timeline.disconnect(self.cin1)
 
227
        self.timeOp_black.disconnect(self.cin1)
204
228
        self.timeOpA.disconnect(self.cin2)
 
229
        timeline.disconnect(self.cin_label)