@ -181,13 +181,13 @@ weston_view_animation_frame(struct weston_animation *base,
}
}
static struct weston_view_animation *
static struct weston_view_animation *
weston_view_animation_run ( struct weston_view * view ,
weston_view_animation_create ( struct weston_view * view ,
float start , float stop ,
float start , float stop ,
weston_view_animation_frame_func_t frame ,
weston_view_animation_frame_func_t frame ,
weston_view_animation_frame_func_t reset ,
weston_view_animation_frame_func_t reset ,
weston_view_animation_done_func_t done ,
weston_view_animation_done_func_t done ,
void * data ,
void * data ,
void * private )
void * private )
{
{
struct weston_view_animation * animation ;
struct weston_view_animation * animation ;
@ -203,14 +203,12 @@ weston_view_animation_run(struct weston_view *view,
animation - > start = start ;
animation - > start = start ;
animation - > stop = stop ;
animation - > stop = stop ;
animation - > private = private ;
animation - > private = private ;
weston_matrix_init ( & animation - > transform . matrix ) ;
weston_matrix_init ( & animation - > transform . matrix ) ;
wl_list_insert ( & view - > geometry . transformation_list ,
wl_list_insert ( & view - > geometry . transformation_list ,
& animation - > transform . link ) ;
& animation - > transform . link ) ;
weston_spring_init ( & animation - > spring , 200.0 , start , stop ) ;
animation - > spring . friction = 700 ;
animation - > animation . frame_counter = 0 ;
animation - > animation . frame = weston_view_animation_frame ;
animation - > animation . frame = weston_view_animation_frame ;
weston_view_animation_frame ( & animation - > animation , NULL , 0 ) ;
animation - > listener . notify = handle_animation_view_destroy ;
animation - > listener . notify = handle_animation_view_destroy ;
wl_signal_add ( & view - > destroy_signal , & animation - > listener ) ;
wl_signal_add ( & view - > destroy_signal , & animation - > listener ) ;
@ -221,6 +219,13 @@ weston_view_animation_run(struct weston_view *view,
return animation ;
return animation ;
}
}
static void
weston_view_animation_run ( struct weston_view_animation * animation )
{
animation - > animation . frame_counter = 0 ;
weston_view_animation_frame ( & animation - > animation , NULL , 0 ) ;
}
static void
static void
reset_alpha ( struct weston_view_animation * animation )
reset_alpha ( struct weston_view_animation * animation )
{
{
@ -258,9 +263,9 @@ weston_zoom_run(struct weston_view *view, float start, float stop,
{
{
struct weston_view_animation * zoom ;
struct weston_view_animation * zoom ;
zoom = weston_view_animation_run ( view , start , stop ,
zoom = weston_view_animation_create ( view , start , stop ,
zoom_frame , reset_alpha ,
zoom_frame , reset_alpha ,
done , data , NULL ) ;
done , data , NULL ) ;
if ( zoom = = NULL )
if ( zoom = = NULL )
return NULL ;
return NULL ;
@ -269,6 +274,8 @@ weston_zoom_run(struct weston_view *view, float start, float stop,
zoom - > spring . friction = 1400 ;
zoom - > spring . friction = 1400 ;
zoom - > spring . previous = start - ( stop - start ) * 0.03 ;
zoom - > spring . previous = start - ( stop - start ) * 0.03 ;
weston_view_animation_run ( zoom ) ;
return zoom ;
return zoom ;
}
}
@ -290,20 +297,21 @@ weston_fade_run(struct weston_view *view,
{
{
struct weston_view_animation * fade ;
struct weston_view_animation * fade ;
fade = weston_view_animation_run ( view , start , end ,
fade = weston_view_animation_create ( view , start , end ,
fade_frame , reset_alpha ,
fade_frame , reset_alpha ,
done , data , NULL ) ;
done , data , NULL ) ;
if ( fade = = NULL )
if ( fade = = NULL )
return NULL ;
return NULL ;
fade - > spring . k = 1000.0 ;
weston_spring_init ( & fade - > spring , 1000.0 , start , end ) ;
fade - > spring . friction = 4000 ;
fade - > spring . friction = 4000 ;
fade - > spring . previous = start - ( end - start ) * 0.1 ;
fade - > spring . previous = start - ( end - start ) * 0.1 ;
view - > alpha = start ;
view - > alpha = start ;
weston_view_animation_run ( fade ) ;
return fade ;
return fade ;
}
}
@ -339,7 +347,7 @@ weston_stable_fade_run(struct weston_view *front_view, float start,
{
{
struct weston_view_animation * fade ;
struct weston_view_animation * fade ;
fade = weston_view_animation_run ( front_view , 0 , 0 ,
fade = weston_view_animation_create ( front_view , 0 , 0 ,
stable_fade_frame , NULL ,
stable_fade_frame , NULL ,
done , data , back_view ) ;
done , data , back_view ) ;
@ -352,6 +360,8 @@ weston_stable_fade_run(struct weston_view *front_view, float start,
front_view - > alpha = start ;
front_view - > alpha = start ;
back_view - > alpha = end ;
back_view - > alpha = end ;
weston_view_animation_run ( fade ) ;
return fade ;
return fade ;
}
}
@ -373,16 +383,18 @@ weston_slide_run(struct weston_view *view, float start, float stop,
{
{
struct weston_view_animation * animation ;
struct weston_view_animation * animation ;
animation = weston_view_animation_run ( view , start , stop ,
animation = weston_view_animation_create ( view , start , stop ,
slide_frame , NULL , done ,
slide_frame , NULL , done ,
data , NULL ) ;
data , NULL ) ;
if ( ! animation )
if ( ! animation )
return NULL ;
return NULL ;
weston_spring_init ( & animation - > spring , 400.0 , start , stop ) ;
animation - > spring . friction = 600 ;
animation - > spring . friction = 600 ;
animation - > spring . k = 400 ;
animation - > spring . clip = WESTON_SPRING_BOUNCE ;
animation - > spring . clip = WESTON_SPRING_BOUNCE ;
weston_view_animation_run ( animation ) ;
return animation ;
return animation ;
}
}
@ -440,13 +452,13 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy,
move - > reverse = reverse ;
move - > reverse = reverse ;
move - > done = done ;
move - > done = done ;
animation = weston_view_animation_run ( view , start , end , move_frame ,
animation = weston_view_animation_create ( view , start , end , move_frame ,
NULL , move_done , data , move ) ;
NULL , move_done , data , move ) ;
if ( animation = = NULL )
if ( animation = = NULL )
return NULL ;
return NULL ;
animation - > spring . k = 400 ;
weston_spring_init ( & animation - > spring , 400.0 , start , end ) ;
animation - > spring . friction = 1150 ;
animation - > spring . friction = 1150 ;
return animation ;
return animation ;