[ease] Fix broken transitions.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease] Fix broken transitions.
- Date: Wed, 2 Jun 2010 22:09:49 +0000 (UTC)
commit e2d3e58e440b4b664ef2cde5425c3d7a174632cd
Author: Nate Stedman <natesm gmail com>
Date: Wed Jun 2 18:09:32 2010 -0400
Fix broken transitions.
src/Player.vala | 35 ++++++---------
src/SlideActor.vala | 114 +++++++++++++++++++++++++-------------------------
2 files changed, 71 insertions(+), 78 deletions(-)
---
diff --git a/src/Player.vala b/src/Player.vala
index a854483..8f66812 100644
--- a/src/Player.vala
+++ b/src/Player.vala
@@ -32,7 +32,7 @@ public class Ease.Player : GLib.Object
// current and transitioning out slide
private SlideActor current_slide;
private SlideActor old_slide;
- private Clutter.Group stack_container;
+ private Clutter.Group container;
// automatic advance alarm
private Clutter.Timeline advance_alarm;
@@ -63,8 +63,8 @@ public class Ease.Player : GLib.Object
Clutter.grab_keyboard(stage);
// make the stacking container
- stack_container = new Clutter.Group();
- stage.add_actor(stack_container);
+ container = new Clutter.Group();
+ stage.add_actor(container);
// make the window that everything will be displayed in
window = new Gtk.Window(Gtk.WindowType.TOPLEVEL);
@@ -123,29 +123,29 @@ public class Ease.Player : GLib.Object
if (slide_index == 0)
{
create_current_slide(slide);
- current_slide.stack(stack_container);
+ current_slide.stack(container);
current_slide.opacity = 0;
current_slide.animate(Clutter.AnimationMode.EASE_IN_SINE,
FADE_IN_TIME, "opacity", 255);
- stage.add_actor(current_slide);
+ container.add_actor(current_slide);
advance_alarm = new Clutter.Timeline(FADE_IN_TIME);
advance_alarm.completed.connect(animation_complete);
advance_alarm.start();
can_animate = false;
-
-
}
+
+ // otherwise, animate as usual
else
{
old_slide = current_slide;
create_current_slide(slide);
- stage.add_actor(current_slide);
+ container.add_actor(current_slide);
if (old_slide.slide.transition_time > 0)
{
- old_slide.transition(current_slide, stack_container);
+ old_slide.transition(current_slide, container);
old_slide.animation_time.completed.connect(animation_complete);
can_animate = false;
}
@@ -170,12 +170,11 @@ public class Ease.Player : GLib.Object
slide_index--;
can_animate = true;
- stage.remove_all();
- stage.add_actor(stack_container);
+ container.remove_all();
create_current_slide(document.slides.get(slide_index));
- current_slide.stack(stack_container);
- stage.add_actor(current_slide);
+ current_slide.stack(container);
+ container.add_actor(current_slide);
}
private void create_current_slide(Slide slide)
@@ -186,16 +185,10 @@ public class Ease.Player : GLib.Object
private void animation_complete()
{
- if (old_slide != null)
- {
- if (old_slide.get_parent() == stage)
- {
- stage.remove_actor(old_slide);
- }
- }
+ container.remove_all();
can_animate = true;
- current_slide.stack(stack_container);
+ current_slide.stack(container);
// prepare to automatically advance if necessary
if (current_slide.slide.automatically_advance)
diff --git a/src/SlideActor.vala b/src/SlideActor.vala
index e9b9565..2788d64 100644
--- a/src/SlideActor.vala
+++ b/src/SlideActor.vala
@@ -233,21 +233,21 @@ public class Ease.SlideActor : Clutter.Group
}
private void prepare_slide_transition(SlideActor new_slide,
- Clutter.Group stack_container)
+ Clutter.Group container)
{
- new_slide.stack(stack_container);
- stack(stack_container);
+ new_slide.stack(container);
+ stack(container);
}
private void prepare_stack_transition(bool current_on_top,
SlideActor new_slide,
- Clutter.Group stack_container)
+ Clutter.Group container)
{
- unstack(new_slide, stack_container);
+ unstack(new_slide, container);
}
public void transition(SlideActor new_slide,
- Clutter.Group stack_container)
+ Clutter.Group container)
{
uint length = (uint)max(1, slide.transition_time * 1000);
@@ -256,71 +256,71 @@ public class Ease.SlideActor : Clutter.Group
switch (slide.transition)
{
case TransitionType.SLIDE:
- slide_transition(new_slide, stack_container, length);
+ slide_transition(new_slide, container, length);
break;
case TransitionType.DROP:
- drop_transition(new_slide, stack_container, length);
+ drop_transition(new_slide, container, length);
break;
case TransitionType.PIVOT:
- pivot_transition(new_slide, stack_container, length);
+ pivot_transition(new_slide, container, length);
break;
case TransitionType.OPEN_DOOR:
- open_door_transition(new_slide, stack_container, length);
+ open_door_transition(new_slide, container, length);
break;
case TransitionType.REVEAL:
- reveal_transition(new_slide, stack_container, length);
+ reveal_transition(new_slide, container, length);
break;
case TransitionType.SLATS:
- slats_transition(new_slide, stack_container, length);
+ slats_transition(new_slide, container, length);
break;
case TransitionType.FLIP:
- flip_transition(new_slide, stack_container, length);
+ flip_transition(new_slide, container, length);
break;
case TransitionType.REVOLVING_DOOR:
- revolving_door_transition(new_slide, stack_container, length);
+ revolving_door_transition(new_slide, container, length);
break;
case TransitionType.FALL:
- fall_transition(new_slide, stack_container, length);
+ fall_transition(new_slide, container, length);
break;
case TransitionType.SPIN_CONTENTS:
- spin_contents_transition(new_slide, stack_container, length);
+ spin_contents_transition(new_slide, container, length);
break;
case TransitionType.SWING_CONTENTS:
- swing_contents_transition(new_slide, stack_container, length);
+ swing_contents_transition(new_slide, container, length);
break;
case TransitionType.ZOOM:
- zoom_transition(new_slide, stack_container, length);
+ zoom_transition(new_slide, container, length);
break;
case TransitionType.SLIDE_CONTENTS:
- slide_contents_transition(new_slide, stack_container, length);
+ slide_contents_transition(new_slide, container, length);
break;
case TransitionType.SPRING_CONTENTS:
- spring_contents_transition(new_slide, stack_container, length);
+ spring_contents_transition(new_slide, container, length);
break;
case TransitionType.ZOOM_CONTENTS:
- zoom_contents_transition(new_slide, stack_container, length);
+ zoom_contents_transition(new_slide, container, length);
break;
case TransitionType.PANEL:
- panel_transition(new_slide, stack_container, length);
+ panel_transition(new_slide, container, length);
break;
default: // FADE, or something undefined
- fade_transition(new_slide, stack_container, length);
+ fade_transition(new_slide, container, length);
break;
}
@@ -328,16 +328,16 @@ public class Ease.SlideActor : Clutter.Group
}
private void fade_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
- prepare_slide_transition(new_slide, stack_container);
+ prepare_slide_transition(new_slide, container);
new_slide.opacity = 0;
new_slide.animate(Clutter.AnimationMode.LINEAR,
length, "opacity", 255);
}
private void slide_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
switch (slide.variant)
{
@@ -368,14 +368,14 @@ public class Ease.SlideActor : Clutter.Group
}
private void drop_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
new_slide.y = -slide.parent.height;
new_slide.animate(EASE_DROP, length, "y", 0);
}
private void pivot_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
float xpos = 0, ypos = 0, angle = 90;
switch (slide.variant)
@@ -409,7 +409,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void flip_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
// hide the new slide
new_slide.opacity = 0;
@@ -496,7 +496,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void revolving_door_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
// set the current slide to slightly above the new slide
@@ -555,7 +555,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void reveal_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
// TODO: make this transition not a total hack
((Clutter.Container)get_parent()).raise_child(this, new_slide);
@@ -586,7 +586,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void fall_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
depth = 1;
@@ -600,11 +600,11 @@ public class Ease.SlideActor : Clutter.Group
}
private void slats_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
// hide the real SlideActors
- reparent(stack_container);
- new_slide.reparent(stack_container);
+ reparent(container);
+ new_slide.reparent(container);
x = slide.parent.width;
new_slide.x = slide.parent.width;
@@ -621,7 +621,7 @@ public class Ease.SlideActor : Clutter.Group
{
// create groups
groups[i] = new Clutter.Group();
- stack_container.add_actor(groups[i]);
+ container.add_actor(groups[i]);
// create clones
this_slats[i] = new Clutter.Clone(this);
@@ -662,7 +662,7 @@ public class Ease.SlideActor : Clutter.Group
// clean up the slats
for (int i = 0; i < SLAT_COUNT; i++)
{
- stack_container.remove_actor(groups[i]);
+ container.remove_actor(groups[i]);
}
// put the new slide in place
@@ -671,7 +671,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void open_door_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
// create a reflection of the new slide
@@ -689,10 +689,10 @@ public class Ease.SlideActor : Clutter.Group
reflection.depth = OPEN_DEPTH;
reflection.animate(Clutter.AnimationMode.EASE_OUT_SINE,
length, "depth", 0);
- stack_container.add_actor(reflection);
+ container.add_actor(reflection);
animate(Clutter.AnimationMode.LINEAR, length, "opacity", 0);
- reparent(stack_container);
+ reparent(container);
x = slide.parent.width;
// create left and right half clone actors
@@ -728,8 +728,8 @@ public class Ease.SlideActor : Clutter.Group
right_group.add_actor(right);
// add the left and right actors
- stack_container.add_actor(left_group);
- stack_container.add_actor(right_group);
+ container.add_actor(left_group);
+ container.add_actor(right_group);
// move the left and right sides outwards
left_group.animate(Clutter.AnimationMode.EASE_IN_OUT_SINE,
@@ -756,12 +756,12 @@ public class Ease.SlideActor : Clutter.Group
// clean up
time1.completed.connect(() => {
- stack_container.remove_actor(left_group);
- stack_container.remove_actor(right_group);
+ container.remove_actor(left_group);
+ container.remove_actor(right_group);
});
time2.completed.connect(() => {
- stack_container.remove_actor(reflection);
+ container.remove_actor(reflection);
});
time1.start();
@@ -769,7 +769,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void zoom_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
switch (slide.variant)
{
@@ -802,7 +802,7 @@ public class Ease.SlideActor : Clutter.Group
}
private void panel_transition(SlideActor new_slide,
- Clutter.Group stack_container, uint length)
+ Clutter.Group container, uint length)
{
float pos = 0;
string property="";
@@ -867,10 +867,10 @@ public class Ease.SlideActor : Clutter.Group
}
private void spin_contents_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
- prepare_stack_transition(false, new_slide, stack_container);
+ prepare_stack_transition(false, new_slide, container);
new_slide.contents.opacity = 0;
background.animate(Clutter.AnimationMode.EASE_IN_OUT_SINE, length,
@@ -903,10 +903,10 @@ public class Ease.SlideActor : Clutter.Group
}
private void swing_contents_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
- prepare_stack_transition(false, new_slide, stack_container);
+ prepare_stack_transition(false, new_slide, container);
new_slide.contents.opacity = 0;
background.animate(Clutter.AnimationMode.EASE_IN_OUT_SINE,
@@ -942,10 +942,10 @@ public class Ease.SlideActor : Clutter.Group
}
private void slide_contents_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
- prepare_stack_transition(false, new_slide, stack_container);
+ prepare_stack_transition(false, new_slide, container);
background.animate(EASE_SLIDE, length, "opacity", 0);
@@ -983,10 +983,10 @@ public class Ease.SlideActor : Clutter.Group
}
private void spring_contents_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
- prepare_stack_transition(false, new_slide, stack_container);
+ prepare_stack_transition(false, new_slide, container);
background.animate(Clutter.AnimationMode.EASE_IN_OUT_SINE, length,
"opacity", 0);
@@ -1011,11 +1011,11 @@ public class Ease.SlideActor : Clutter.Group
}
private void zoom_contents_transition(SlideActor new_slide,
- Clutter.Group stack_container,
+ Clutter.Group container,
uint length)
{
prepare_stack_transition(slide.variant == TransitionVariant.OUT,
- new_slide, stack_container);
+ new_slide, container);
animation_alpha = new Clutter.Alpha.full(animation_time,
Clutter.AnimationMode.EASE_IN_OUT_SINE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]