struct wl_listener listener;
float start, stop;
weston_surface_animation_frame_func_t frame;
+ weston_surface_animation_frame_func_t reset;
weston_surface_animation_done_func_t done;
void *data;
};
wl_list_remove(&animation->animation.link);
wl_list_remove(&animation->listener.link);
wl_list_remove(&animation->transform.link);
+ if (animation->reset)
+ animation->reset(animation);
weston_surface_geometry_dirty(animation->surface);
if (animation->done)
animation->done(animation, animation->data);
weston_surface_animation_run(struct weston_surface *surface,
float start, float stop,
weston_surface_animation_frame_func_t frame,
+ weston_surface_animation_frame_func_t reset,
weston_surface_animation_done_func_t done,
void *data)
{
animation->surface = surface;
animation->frame = frame;
+ animation->reset = reset;
animation->done = done;
animation->data = data;
animation->start = start;
}
static void
+reset_alpha(struct weston_surface_animation *animation)
+{
+ struct weston_surface *surface = animation->surface;
+
+ surface->alpha = animation->stop;
+}
+
+static void
zoom_frame(struct weston_surface_animation *animation)
{
struct weston_surface *es = animation->surface;
struct weston_surface_animation *zoom;
zoom = weston_surface_animation_run(surface, start, stop,
- zoom_frame, done, data);
+ zoom_frame, reset_alpha,
+ done, data);
weston_spring_init(&zoom->spring, 300.0, start, stop);
zoom->spring.friction = 1400;
{
struct weston_surface_animation *fade;
- fade = weston_surface_animation_run(surface, 0, 0,
- fade_frame, done, data);
+ fade = weston_surface_animation_run(surface, 0, end,
+ fade_frame, reset_alpha,
+ done, data);
weston_spring_init(&fade->spring, k, start, end);
struct weston_surface_animation *animation;
animation = weston_surface_animation_run(surface, start, stop,
- slide_frame, done, data);
+ slide_frame, NULL, done,
+ data);
if (!animation)
return NULL;