static void prv_slide_settle_stopped(Animation *animation, bool finished, void *context) { Layer *layer = (Layer*) animation_get_context(animation); SelectionLayerData *data = layer_get_data(layer); data->slide_settle_anim_progress = 0; animation_destroy(animation); }
static void prv_slide_settle_impl(struct Animation *animation, const AnimationProgress distance_normalized) { Layer *layer = (Layer*)animation_get_context(animation); SelectionLayerData *data = layer_get_data(layer); data->slide_settle_anim_progress = 100 - ((100 * distance_normalized) / ANIMATION_NORMALIZED_MAX); layer_mark_dirty(layer); }
static void prv_slide_stopped(Animation *animation, bool finished, void *context) { Layer *layer = (Layer*)animation_get_context(animation); SelectionLayerData *data = layer_get_data(layer); data->slide_amin_progress = 0; if (data->slide_is_forward) { data->selected_cell_idx++; } else { data->selected_cell_idx--; } animation_destroy(animation); }
static void prv_bump_text_stopped(Animation *animation, bool finished, void *context) { Layer *layer = (Layer*)animation_get_context(animation); SelectionLayerData *data = layer_get_data(layer); data->bump_text_anim_progress = 0; if (data->bump_is_upwards == true) { data->callbacks.increment(data->selected_cell_idx, 1, data->context); } else { data->callbacks.decrement(data->selected_cell_idx, 1, data->context); } animation_destroy(animation); Animation *bump_settle = prv_create_bump_settle_animation(layer); animation_schedule(bump_settle); }
static void prv_slide_stopped(Animation *animation, bool finished, void *context) { Layer *layer = (Layer*)animation_get_context(animation); SelectionLayerData *data = layer_get_data(layer); data->slide_amin_progress = 0; if (data->slide_is_forward) { data->selected_cell_idx++; } else { data->selected_cell_idx--; } animation_destroy(animation); #ifndef PBL_SDK_3 Animation *settle_animation = prv_create_slide_settle_animation(layer); animation_schedule(settle_animation); #endif }
static void animationUpdate(Animation *animation, const AnimationProgress progress) { DashboardLayer *dashboard_layer = (DashboardLayer *)animation_get_context(animation); int percent = progress * 100 / ANIMATION_NORMALIZED_MAX; DashboardData dashboard_data = dashboard_layer->dashboard_data; switch(dashboard_data.displayed_measure){ case Temperature: ; int16_t temperature = dashboard_data.temperature*percent/100; snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%s%d.%d°", temperature/10 == 0 && temperature < 0 ? "-" : "", temperature/10, abs(temperature)%10); break; case Humidity: snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%d", dashboard_data.humidity*percent/100);break; case CO2: snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%d", dashboard_data.co2*percent/100);break; case Noise: snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%d", dashboard_data.noise*percent/100);break; case Pressure: ; uint16_t pressure = dashboard_data.pressure*percent/100; snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%d.%d", pressure/10, pressure%10);break; case Rain: ; uint16_t rain = dashboard_data.rain*percent/100; snprintf(dashboard_layer->text_main, sizeof(dashboard_layer->text_main), "%d.%03d", rain/1000, rain%1000); break; default:break; } }