Beispiel #1
0
static void do_animation() {
	GRect red_start, red_finish;
	GRect blue_start, blue_finish;
	GRect yellow_start, yellow_finish;
	GRect time_start, time_finish;
	GRect date_start, date_finish;
	
	red_start = GRect(-42,0,42,168);
	red_finish = GRect(0,0,42,168);
	
	blue_start = GRect(0,-168,144,168);
	blue_finish = GRect(0,0,144,168);
	
	yellow_start = GRect(144,120,144,48);
	yellow_finish = GRect(0,120,144,48);
	
	time_start = GRect(144,0,144,168);
	time_finish = GRect(0,0,144,168);
	
	date_start = GRect(-144,0,144,168);
	date_finish = GRect(0,0,144,168);
	
    s_red_anim = property_animation_create_layer_frame(s_red_parent, &red_start, &red_finish);
    animation_set_duration((Animation*)s_red_anim, ANIM_DURATION);
    animation_set_delay((Animation*)s_red_anim, ANIM_RED_DELAY);
    animation_set_curve((Animation*)s_red_anim, AnimationCurveLinear);
    animation_schedule((Animation*)s_red_anim);
	
	s_blue_anim = property_animation_create_layer_frame(s_blue_layer, &blue_start, &blue_finish);
    animation_set_duration((Animation*)s_blue_anim, ANIM_DURATION);
    animation_set_delay((Animation*)s_blue_anim, ANIM_BLUE_DELAY);
    animation_set_curve((Animation*)s_blue_anim, AnimationCurveLinear);
    animation_schedule((Animation*)s_blue_anim);
	
	s_yellow_anim = property_animation_create_layer_frame(s_yellow_layer, &yellow_start, &yellow_finish);
    animation_set_duration((Animation*)s_yellow_anim, ANIM_DURATION);
    animation_set_delay((Animation*)s_yellow_anim, ANIM_YELLOW_DELAY);
    animation_set_curve((Animation*)s_yellow_anim, AnimationCurveLinear);
    animation_schedule((Animation*)s_yellow_anim);
	
	s_time_anim = property_animation_create_layer_frame(s_time_layer, &time_start, &time_finish);
    animation_set_duration((Animation*)s_time_anim, ANIM_DURATION);
    animation_set_delay((Animation*)s_time_anim, ANIM_TIME_DELAY);
    animation_set_curve((Animation*)s_time_anim, AnimationCurveLinear);
    animation_schedule((Animation*)s_time_anim);
	
	s_date_anim = property_animation_create_layer_frame(s_date_layer, &date_start, &date_finish);
    animation_set_duration((Animation*)s_date_anim, ANIM_DURATION);
    animation_set_delay((Animation*)s_date_anim, ANIM_TIME_DELAY);
    animation_set_curve((Animation*)s_date_anim, AnimationCurveLinear);
    animation_schedule((Animation*)s_date_anim);
}
Beispiel #2
0
static void onWindowLoad(Window *window) {
    // 配置按键
    window_set_click_config_provider(window, clickConfigProvider);

    // 窗口信息
    Layer *layer = window_get_root_layer(window);
    bounds = layer_get_bounds(layer);

    // bitmap图层
    GRect fromRect = GRect(0, 0, bounds.size.w, bounds.size.h);
    GRect toRect = GRect(0, bounds.size.h, bounds.size.w, bounds.size.h);
    bitmapLayer = bitmap_layer_create(fromRect);

    // bitmap对象
    bitmap = gbitmap_create_with_resource(RESOURCE_ID_MY_LOGO);
    bitmap_layer_set_compositing_mode(bitmapLayer, GCompOpSet);
    bitmap_layer_set_bitmap(bitmapLayer, bitmap);

    // logo动画
    PropertyAnimation *propAnim = property_animation_create_layer_frame((Layer *)bitmapLayer, &fromRect, &toRect);
    Animation *anim = property_animation_get_animation(propAnim);
    const int delay_ms = 1000;
    const int duration_ms = 3000;
    animation_set_curve(anim, AnimationCurveEaseOut);
    animation_set_delay(anim, delay_ms);
    animation_set_duration(anim, duration_ms);
    animation_schedule(anim);

    // 添加图层
    layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(bitmapLayer));
}
void handle_init() {
	Layer *rootLayer;
	int i;
	
	window = window_create();
	window_set_background_color(window, GColorWhite);
	window_stack_push(window, true);
	
	readConfig();
	app_message_init();

	rootLayer = window_get_root_layer(window);
	
	for (i=0; i<NUMSLOTS; i++) {
		initSlot(i, rootLayer);
	}
		
	animImpl.setup = NULL;
	animImpl.update = animateDigits;
	animImpl.teardown = NULL;
	
	anim = animation_create();
	animation_set_delay(anim, 0);
	animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION);
	animation_set_implementation(anim, &animImpl);
	
	app_timer_register(STARTDELAY, handle_timer, NULL);

	tick_timer_service_subscribe(MINUTE_UNIT, handle_tick);
	
	accel_tap_service_subscribe(handle_tap);
	
	lastBluetoothStatus = bluetooth_connection_service_peek();
	bluetooth_connection_service_subscribe(handle_bluetooth);
}
void pptoaster_handle_animation_in_stopped(Animation *animation, bool finished, void *property_animation_context) {
  if (!finished) return;
  static GRect toframe;

  GSize size = pptoaster.layer_frame.size;
  toframe.size = size;
  toframe.origin.x = PPTOASTER_EDGE_MARGIN;
  switch (pptoaster.direction) {
    case PPToasterAppearFromBottom:
      toframe.origin.y = pptoaster.window_size.h;
      break;
    case PPToasterAppearFromTop:
      toframe.origin.y = -size.h - PPTOASTER_EDGE_MARGIN;
      break;
    case PPToasterAppearFromMiddle:
      toframe.origin.y = pptoaster.window_size.h / 2;
      toframe.size.h = 1;
      break;
  }

  pptoaster_destroy_animation();
  pptoaster.propanim = property_animation_create_layer_frame(pptoaster.layer, NULL, &toframe);
  Animation *internal_animation = &pptoaster.propanim->animation;
  animation_set_delay(internal_animation, pptoaster.show_duration);
  animation_set_duration(internal_animation, PPTOASTER_ANIMATION_DURATION);
  animation_set_handlers(internal_animation, (AnimationHandlers){.stopped = pptoaster_handle_animation_out_stopped}, NULL);
void handle_init(AppContextRef ctx) {
	Layer *rootLayer;
	int i;

	window_init(&window, "Squared");
	window_stack_push(&window, true /* Animated */);
	window_set_background_color(&window, GColorBlack);

	rootLayer = window_get_root_layer(&window);

	for (i=0; i<NUMSLOTS; i++) {
		initSlot(i, rootLayer);
	}

	animImpl.setup = NULL;
	animImpl.update = animateDigits;
	animImpl.teardown = NULL;

	animation_init(&anim);
	animation_set_delay(&anim, 0);
	animation_set_duration(&anim, DIGIT_CHANGE_ANIM_DURATION);
	animation_set_implementation(&anim, &animImpl);

	app_timer_send_event(ctx, STARTDELAY /* milliseconds */, 0);
}
Beispiel #6
0
void spin_globe(int delay, int direction) {
  s_globe_animation = animation_create();
  animation_set_delay((Animation*)s_globe_animation, delay);
  animation_set_duration((Animation*)s_globe_animation, ANIMATION_DURATION);
  animation_set_curve((Animation*)s_globe_animation, delay != 0 ? AnimationCurveEaseInOut : AnimationCurveEaseOut);
  animation_set_handlers((Animation*)s_globe_animation, (AnimationHandlers) {
    .started = anim_started_handler,
    .stopped = anim_stopped_handler
  }, NULL);
Beispiel #7
0
void schedule_graph_animation(GRect start, GRect finish) {
  // Schedule the graph animation
  s_graph_animation = property_animation_create_layer_frame(s_graph_layer, &start, &finish);
  animation_set_duration((Animation*)s_graph_animation, ANIM_DURATION);
  animation_set_delay((Animation*)s_graph_animation, ANIM_DELAY);
  animation_set_curve((Animation*)s_graph_animation, AnimationCurveEaseInOut);
  animation_set_handlers((Animation*)s_graph_animation, (AnimationHandlers) {
    .started = anim_started_handler,
    .stopped = anim_stopped_handler
  }, NULL);
Beispiel #8
0
static void animate_in(TextLayer *tlayer, PropertyAnimation *anim, GRect r_rect, GRect c_rect, GRect l_rect, uint32_t delay) {
    Layer *layer = text_layer_get_layer(tlayer);
    anim = property_animation_create_layer_frame(layer, &r_rect, &c_rect);
	animation_set_duration((Animation*) anim, 400);
	animation_set_curve((Animation*) anim, AnimationCurveEaseOut);
    animation_set_delay((Animation*) anim, delay);
    animation_set_handlers((Animation*) anim, (AnimationHandlers) {
        .started = (AnimationStartedHandler) animation_started,
        .stopped = (AnimationStoppedHandler) animation_stopped
    }, NULL /* callback data */);
void setup_text_layer(TextLayer* row, PropertyAnimation *this_anim, int x, int y, int oldx, int oldy, GFont font, int magic, bool delayed, bool black){
    int rectheight = 50;
    text_layer_set_text_color(row, GColorWhite);
    if (black) {
        text_layer_set_background_color(row, GColorBlack);
        rectheight = 37;
    } else {
        text_layer_set_background_color(row, GColorClear);
    }
    layer_add_child(&window.layer, &row->layer);
    text_layer_set_font(row,font);
    
    int speed = 1000;
    int distance = oldy - y;
    
    if (distance < 0) { distance *= -1; }
    
    if (firstblood) {
        speed = 600;
    } else if (x == -144) {
        speed = 1400;
    } else if (oldx == 144) {
        speed = 1000;
    } else {
        speed = 500;
    }
    
    GRect start_rect = GRect(oldx,oldy,144-oldx-1,rectheight);
    GRect target_rect = GRect(x,y,144-x-1,rectheight);
    
    if (magic == 1) { // disappear
        start_rect = GRect(oldx,oldy,144-oldx-1,rectheight);
        target_rect = GRect(-114,oldy,144-oldx-1,rectheight);
    } else if (magic == 2) { // reappear
        start_rect = GRect(144,y,144-x-1,rectheight);
        target_rect = GRect(x,y,144-x-1,rectheight);
    } else if (magic == 3) { // and stay down
        start_rect = GRect(0,0,0,0);
        target_rect = GRect(0,0,0,0);
        speed = 1;
    } else {
    }
    
    if (magic != 3) {
        layer_set_frame(&row->layer, start_rect);
        property_animation_init_layer_frame(this_anim, &row->layer, NULL, &target_rect);
        
        animation_set_duration(&this_anim->animation, speed);  
        animation_set_curve(&this_anim->animation, AnimationCurveEaseInOut);
        if (delayed) {
            animation_set_delay(&this_anim->animation, 100);
        }
        animation_schedule(&this_anim->animation);
    }
}
Beispiel #10
0
static void animate(int duration, int delay, AnimationImplementation *implementation, bool handlers) {
  Animation *anim = animation_create();
  animation_set_duration(anim, duration);
  animation_set_delay(anim, delay);
  animation_set_curve(anim, AnimationCurveEaseInOut);
  animation_set_implementation(anim, implementation);
  if(handlers) {
    animation_set_handlers(anim, (AnimationHandlers) {
      .started = animation_started,
      .stopped = animation_stopped
    }, NULL);
  }
Beispiel #11
0
void batteryLineArc(GContext *ctx, float start_angle, float end_angle, GPoint centre, int radius, int thickness){
	
	float minus_bit = radius - thickness/2 + 0.5;// + (user_battery_colour <= 1 ? 0.5 : 0); //add 0.5 for the int casting, later !!! dark colours like 1.0, light better with 0.5
	float add_bit = (radius + thickness/2 + 0.5); 
	
	graphics_context_set_stroke_width(ctx, 1);
	
	if (start_angle == 0) {
		start_angle = 2.5;	// for some reason, 0 seems to start too far to the left....at least for my purposes
	}
	
	for (float i = start_angle; i <= end_angle; i+=0.5) {
		
		GPoint inside_point = (GPoint) {
			.x = (int16_t)(sin_lookup(i * TRIG_MAX_ANGLE / 360) * minus_bit / TRIG_MAX_RATIO) + centre.x,
			.y = (int16_t)(-cos_lookup(i * TRIG_MAX_ANGLE / 360) * minus_bit / TRIG_MAX_RATIO) + centre.y,
		};

		GPoint outside_point = (GPoint) {
			.x = (int16_t)(sin_lookup(i * TRIG_MAX_ANGLE / 360) * add_bit / TRIG_MAX_RATIO) + centre.x,
			.y = (int16_t)(-cos_lookup(i * TRIG_MAX_ANGLE / 360) * add_bit / TRIG_MAX_RATIO) + centre.y,
		};
		
		graphics_draw_line(ctx, inside_point, outside_point);
	}
}


/*************************** AnimationImplementation **************************/

static void animation_started(Animation *anim, void *context) {
  s_animating = true;
}

static void animation_stopped(Animation *anim, bool stopped, void *context) {
  s_animating = false;
}

static void animate(int duration, int delay, AnimationImplementation *implementation, bool handlers) {
  Animation *anim = animation_create();
  animation_set_duration(anim, duration);
  animation_set_delay(anim, delay);
  animation_set_curve(anim, AnimationCurveEaseInOut);
  animation_set_implementation(anim, implementation);
  
	if(handlers) {
    animation_set_handlers(anim, (AnimationHandlers) {
      .started = animation_started,
      .stopped = animation_stopped
    }, NULL);
  }
  animation_schedule(anim);
}
Beispiel #12
0
static void animate_out(TextLayer *tlayer, PropertyAnimation *anim, GRect r_rect, GRect c_rect, GRect l_rect, uint32_t delay) {
    Layer *layer = text_layer_get_layer(tlayer);
    destroy_property_animation(&anim);
    anim = property_animation_create_layer_frame(layer, NULL, &l_rect);
	animation_set_duration((Animation*) anim, 400);
	animation_set_curve((Animation*) anim, AnimationCurveEaseIn);
    animation_set_delay((Animation*) anim, delay);
//    animation_set_handlers((Animation*) anim, (AnimationHandlers) {
//        .stopped = (AnimationStoppedHandler) animation_stopped
//    }, NULL /* callback data */);
	animation_schedule((Animation*) anim);
}
Beispiel #13
0
void schedule_animation(PblTm *tick_time) {

  static bool use_upper_to_rect = false;

  int32_t animation_delay_required_in_ms = 60000 - (tick_time->tm_sec * 1000) - (ANIMATION_DURATION_IN_MS - 100);

  if (animation_delay_required_in_ms < 0) {
    // In the hopefully rare case that we don't have time to schedule the animation
    // before the value is due to change we just let it change in place.
    return;
  }

  if (use_upper_to_rect) {
    animation_set_delay(&up_animation.animation, animation_delay_required_in_ms);
    animation_schedule(&up_animation.animation);
  } else {
    animation_set_delay(&down_animation.animation, animation_delay_required_in_ms);
    animation_schedule(&down_animation.animation);
  }

  use_upper_to_rect = !use_upper_to_rect;

}
static Animation *activity_indicator_layer_create_animation(Layer *layer) {
  Animation *animations[3];
  const uint32_t duration = 1000;
  uint32_t from = 0, to = TRIG_MAX_ANGLE;

  animations[0] = ({
    PropertyAnimation *property_animation = property_animation_create(&property_animation_implementation_stroke_start, layer, NULL, NULL);
    property_animation_from(property_animation, &from, sizeof(from), true);
    property_animation_to(property_animation, &to, sizeof(to), true);

    Animation *animation = (Animation *)property_animation;
    animation_set_custom_curve(animation, stroke_start_custom_curve);
    animation_set_delay(animation, duration * 2 / 3);
    animation_set_duration(animation, duration);
    animation_set_play_count(animation, ANIMATION_PLAY_COUNT_INFINITE);

    animation;
  });
Beispiel #15
0
void setup_bolt_animation()
{
	int total_send_delay = 0;
	for(int x = 0; x < FRAME_COUNT - 1; x++) //-1 because animate_bolt looks at the current frame and the next frame in the array
	{
		bolt_animation[x] = property_animation_create_layer_frame(bitmap_layer_get_layer(bolt), &bolt_frames[x].frame, &bolt_frames[x + 1].frame);
		animation_set_duration((Animation*) bolt_animation[x], bolt_frames[x].duration);
		animation_set_delay((Animation*) bolt_animation[x], total_send_delay);
		animation_set_curve((Animation*) bolt_animation[x], AnimationCurveLinear);
		total_send_delay += bolt_frames[x].duration;

		if(x == FRAME_COUNT - 2) //-2 because that is the last item when the condition to break is < X - 1
		{
			animation_set_handlers((Animation*) bolt_animation[x], (AnimationHandlers) {
    			.started = (AnimationStartedHandler) bolt_animation_started,
    			.stopped = (AnimationStoppedHandler) bolt_animation_stopped,
            }, NULL /* callback data */);
		}
static void _animation_stopped( struct Animation* animation, bool finished, void* context )
{
  Layer* layer = (Layer*)context;
  with_movie_layer( layer, data,
  {
    GRect base = {
      .origin = data->origin,
      .size   = { .h = layer_get_frame( layer ).size.h, .w = SCREEN_WIDTH }
    };

    GRect off_screen = {
      .origin = { .x = -SCREEN_WIDTH, .y = data->origin.y },
      .size   = { .h = layer_get_frame( layer ).size.h, .w = SCREEN_WIDTH }
    };

    switch( data->animation_mode )
    {
      case MovieTextUpdateNone:
      case MovieTextUpdateInstant:
      case MovieTextUpdateDelay:
      break;

      case MovieTextUpdateSlideRight:
      case MovieTextUpdateSlideThrough:
        off_screen.origin.x = SCREEN_WIDTH;
        /* break; */

      case MovieTextUpdateSlideLeft:
      {
        if( data->animating_out )
        {
          if( data->buf_r )
          {
            strncpy( data->buf_l, data->buf_r, sizeof( data->buf_l ) );
          }
        }
        break;
      }

    }

    if( data->animating_out && finished )
    {

      data->animating_out = false;
      data->animating_in  = true;

      data->animation->values.from.grect = off_screen;
      data->animation->values.to.grect   = base;

      layer_set_frame( (Layer*)layer, off_screen );
      animation_set_delay( (Animation*)data->animation, 0 );
      animation_set_duration( (Animation*)data->animation, 500 );
      animation_schedule( (Animation*)data->animation );
    }
    else
    {
      layer_set_frame( layer, base );

      data->animating_in  = false;
      data->animating_out = false;
      data->animation_mode = MovieTextUpdateInstant;
    }
  } )
Beispiel #17
0
void createAnim() {
  anim = animation_create();
  animation_set_delay(anim, 0);
  animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION);
  animation_set_implementation(anim, &animImpl);
}
Beispiel #18
0
//-----------------------------------------------------------------------------------------------------------------------
static void window_load(Window *window) 
{
	Layer *window_layer = window_get_root_layer(window);
	GRect bounds = layer_get_bounds(window_layer);
	
	digitS = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_DIGITAL_23));
	bmp_mask = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK);
	
	// Init layers
	face_layer = layer_create(GRect(0, 0, bounds.size.w, bounds.size.w));
	layer_set_update_proc(face_layer, face_update_proc);

	date_layer = text_layer_create(GRect(-bounds.size.w, bounds.size.h-n_bottom_margin-2, bounds.size.w, n_bottom_margin));
	text_layer_set_text_alignment(date_layer, GTextAlignmentCenter);
	text_layer_set_font(date_layer, digitS);

	//Init bluetooth radio
	radio_layer = bitmap_layer_create(GRect(1, bounds.size.h, 10, 20));
	bitmap_layer_set_background_color(radio_layer, GColorClear);
		
	//Init battery
	battery_layer = bitmap_layer_create(GRect(bounds.size.w-11, bounds.size.h, 10, 20)); 
	bitmap_layer_set_background_color(battery_layer, GColorClear);

	//Update Configuration
	update_configuration();
	
	//Start|Skip Animation
	if (CfgData.anim)
	{
		aktHH = aktMM = 0;
		timer_face = app_timer_register(500, timerCallback, (void*)TIMER_ANIM_FACE);
		
		//Animate Date
		GRect rc_from = layer_get_frame(text_layer_get_layer(date_layer));
		GRect rc_to = rc_from;
		rc_to.origin.x = 0;

		s_prop_anim_date = property_animation_create_layer_frame(text_layer_get_layer(date_layer), &rc_from, &rc_to);
		animation_set_curve((Animation*)s_prop_anim_date, AnimationCurveEaseOut);
		animation_set_delay((Animation*)s_prop_anim_date, 500);
		animation_set_duration((Animation*)s_prop_anim_date, 1000);
		animation_schedule((Animation*)s_prop_anim_date);
		
		//Animate Bluetooth
		rc_from = layer_get_frame(bitmap_layer_get_layer(radio_layer));
#if defined(PBL_RECT)
		rc_to = rc_from;
		rc_to.origin.y -= rc_from.size.h+1;
#elif defined(PBL_ROUND)
		rc_from = GRect(-rc_from.size.w, bounds.size.h/2-rc_from.size.h/2, rc_from.size.w, rc_from.size.h);
		rc_to = rc_from;
		rc_to.origin.x = 4;
#endif		
		s_prop_anim_bt = property_animation_create_layer_frame(bitmap_layer_get_layer(radio_layer), &rc_from, &rc_to);
		animation_set_curve((Animation*)s_prop_anim_bt, AnimationCurveEaseOut);
		animation_set_delay((Animation*)s_prop_anim_bt, 1500);
		animation_set_duration((Animation*)s_prop_anim_bt, 1000);
		animation_schedule((Animation*)s_prop_anim_bt);
		
		//Animate Battery
		rc_from = layer_get_frame(bitmap_layer_get_layer(battery_layer));
#if defined(PBL_RECT)
		rc_to = rc_from;
		rc_to.origin.y -= rc_from.size.h+1;
#elif defined(PBL_ROUND)
		rc_from = GRect(bounds.size.w, bounds.size.h/2-rc_from.size.h/2, rc_from.size.w, rc_from.size.h);
		rc_to = rc_from;
		rc_to.origin.x = bounds.size.w-rc_from.size.w-4;
#endif		
		s_prop_anim_batt = property_animation_create_layer_frame(bitmap_layer_get_layer(battery_layer), &rc_from, &rc_to);
		animation_set_curve((Animation*)s_prop_anim_batt, AnimationCurveEaseOut);
		animation_set_delay((Animation*)s_prop_anim_batt, 2000);
		animation_set_duration((Animation*)s_prop_anim_batt, 1000);
		animation_schedule((Animation*)s_prop_anim_batt);
	}	
	else
	{	
		GRect rc = layer_get_frame(text_layer_get_layer(date_layer));
		rc.origin.x = 0;
		layer_set_frame(text_layer_get_layer(date_layer), rc);
		
		rc = layer_get_frame(bitmap_layer_get_layer(radio_layer));
#if defined(PBL_RECT)
		rc.origin.y -= rc.size.h+1;
#elif defined(PBL_ROUND)
		rc = GRect(4, bounds.size.h/2-rc.size.h/2, rc.size.w, rc.size.h);
#endif		
		layer_set_frame(bitmap_layer_get_layer(radio_layer), rc);
		
		rc = layer_get_frame(bitmap_layer_get_layer(battery_layer));
#if defined(PBL_RECT)
		rc.origin.y -= rc.size.h+1;
#elif defined(PBL_ROUND)
		rc = GRect(bounds.size.w-rc.size.w-4, bounds.size.h/2-rc.size.h/2, rc.size.w, rc.size.h);
#endif		
		layer_set_frame(bitmap_layer_get_layer(battery_layer), rc);
		
		b_initialized = true;
	}
}
Beispiel #19
0
static void next_animation() {
  // Determine start and finish positions
  Layer *window_layer = window_get_root_layer(s_main_window);
  GRect bounds = layer_get_frame(window_layer);
  
  GRect start, finish;
  
  int i_Kreis = layer_get_frame(window_layer).size.w / 5;
  APP_LOG(APP_LOG_LEVEL_INFO, "i_Kreis: %d", i_Kreis);
  int i_X = 0;
  int i_Y = 0;
  int i_X_alt = 0;
  int i_Y_alt = 0;
  
  int i_delay = ANIM_DELAY;
  int i_duration = ANIM_DURATION;
  
  switch (s_current_stage) {
    case 0:
      
      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: %d", 0);
      i_delay = ANIM_FIRST_DELAY;
      
      //Layer positionieren
      layer_set_frame(bitmap_layer_get_layer(s_bgbox_layer), GRect(bounds.size.w+1, 0, bounds.size.w, bounds.size.h));
      
      //Layer sichtbarkeit anpassen
      layer_set_hidden(s_box2_layer, true);
      layer_set_hidden(s_bg_layer, true);
      layer_set_hidden(bitmap_layer_get_layer(s_bgbox_layer), true);
      layer_set_hidden(bitmap_layer_get_layer(s_logo_layer), true);
      layer_set_hidden(text_layer_get_layer(s_date_layer), true);
      layer_set_hidden(text_layer_get_layer(s_time_layer), true);

      //"Alt"-Koordinaten ermitteln
      i_X_alt = - BOX_SIZE;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = 0;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);
      
      //Animationsebene sichtbar machen
      layer_set_hidden(s_box_layer, false);
      break;

    case 1:

      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 1");

      //"Alt"-Koordinaten ermitteln
      i_X_alt = 0;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = i_Kreis;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);

      //Kreiskopie positionieren
      layer_set_frame(s_box2_layer, start);

      //Kreiskopie sichtbar machen
      layer_set_hidden(s_box2_layer, false);
      break;

    case 2:

      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 2");

      //"Alt"-Koordinaten ermitteln
      i_X_alt = i_Kreis;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = i_Kreis*2;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);

      //Kreiskopie positionieren
      layer_set_frame(s_box2_layer, start);

      break;

    case 3:

      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 3");

      //Layer sichtbarkeit anpassen
      layer_set_hidden(s_box2_layer, true);

      //"Alt"-Koordinaten ermitteln
      i_X_alt = i_Kreis*2;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = i_Kreis*3;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);

      //Kreiskopie positionieren
      layer_set_frame(s_box2_layer, start);

      //Kreiskopie sichtbar machen
      layer_set_hidden(s_box2_layer, false);
      break;

    case 4:

      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 4");

      //Layer sichtbarkeit anpassen
      layer_set_hidden(s_box2_layer, true);

      //"Alt"-Koordinaten ermitteln
      i_X_alt = i_Kreis*3;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = i_Kreis*4;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);

      //Kreiskopie positionieren
      layer_set_frame(s_box2_layer, start);

      //Kreiskopie sichtbar machen
      layer_set_hidden(s_box2_layer, false);
      break;

    case 5:

      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 5");

      //Layer sichtbarkeit anpassen
      layer_set_hidden(s_box2_layer, true);

      //"Alt"-Koordinaten ermitteln
      i_X_alt = i_Kreis*4;  
      i_Y_alt = (bounds.size.h - BOX_SIZE)/2;
      
      //Neue Koordinaten
      i_X = bounds.size.h;
      i_Y = i_Y_alt;
        
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, BOX_SIZE, BOX_SIZE);
      finish = GRect(i_X, i_Y, BOX_SIZE, BOX_SIZE);

      //Kreiskopie positionieren
      layer_set_frame(s_box2_layer, start);

      //Kreiskopie sichtbar machen
      layer_set_hidden(s_box2_layer, false);
      break;

    
    case 6:
      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 6");
  
      i_duration = ANIM_DURATION * 2;
    
      //Kreise ausblenden
      layer_set_hidden(s_box_layer, true);
      layer_set_hidden(s_box2_layer, true);
      layer_set_frame(s_box_layer, GRect(-BOX_SIZE,(bounds.size.h - BOX_SIZE)/2, BOX_SIZE, BOX_SIZE));
      layer_set_frame(s_box2_layer, GRect(-BOX_SIZE,(bounds.size.h - BOX_SIZE)/2, BOX_SIZE, BOX_SIZE));
    
      //Animations_Layer einbelnden
      layer_set_hidden(bitmap_layer_get_layer(s_bgbox_layer), false);

      //"Alt"-Koordinaten ermitteln
      i_X_alt = bounds.size.w+1;  
      i_Y_alt = 0;
      
      //Neue Koordinaten
      i_X = -1;
      i_Y = 0;
       
      //Animationskoordinaten setzen
      start = GRect(i_X_alt, i_Y_alt, bounds.size.w, bounds.size.h);
      finish = GRect(i_X, i_Y, bounds.size.w, bounds.size.h);
      break;
    
    case 7:
      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: 7");

      layer_set_hidden(bitmap_layer_get_layer(s_bgbox_layer), true);
      layer_set_hidden(text_layer_get_layer(s_date_layer), false);
      layer_set_hidden(text_layer_get_layer(s_time_layer), false);
      psleep(200);
      layer_set_hidden(s_bg_layer, false);
      layer_set_hidden(bitmap_layer_get_layer(s_logo_layer), false);
      break;

    default:
      APP_LOG(APP_LOG_LEVEL_INFO, "Animation Schritt: default");

      start = GRect(-BOX_SIZE, (bounds.size.h - BOX_SIZE)/2 , BOX_SIZE, BOX_SIZE);
      finish = GRect(-BOX_SIZE, (bounds.size.h - BOX_SIZE)/2 , BOX_SIZE, BOX_SIZE);
      break;
  }

  APP_LOG(APP_LOG_LEVEL_INFO, "Animation von X=%d nach X=%d", i_X_alt, i_X);

  if (s_current_stage < ANI_STEPS){
    // Schedule the next animation
    switch (s_current_stage) {
      case 0-5:
        s_box_animation = property_animation_create_layer_frame(s_box_layer, &start, &finish);
        animation_set_curve((Animation*)s_box_animation, AnimationCurveLinear);
        break;
      
      case 6:
        s_box_animation = property_animation_create_layer_frame(bitmap_layer_get_layer(s_bgbox_layer), &start, &finish); 
        animation_set_curve((Animation*)s_box_animation, AnimationCurveEaseOut);
      break;
      
      default:
        s_box_animation = property_animation_create_layer_frame(s_box_layer, &start, &finish);
        break;
    }
    
    animation_set_duration((Animation*)s_box_animation, i_duration);
    animation_set_delay((Animation*)s_box_animation, i_delay);
    animation_set_handlers((Animation*)s_box_animation, (AnimationHandlers) {
      .stopped = anim_stopped_handler
    }, NULL);
    
    //Animation starten
    animation_schedule((Animation*)s_box_animation); 
    
    //Step erhöhen
    s_current_stage = (s_current_stage + 1);

  } else {