mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 06:28:36 -07:00
Add anim speed setting
This commit is contained in:
@@ -514,6 +514,11 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break; //-V779
|
||||
animation->active_cycles = u32value;
|
||||
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
|
||||
uint16_t anim_speed = XTREME_SETTINGS()->anim_speed;
|
||||
anim_speed = (anim_speed == 0 ? 100 : anim_speed);
|
||||
u32value = (u32value * anim_speed) / 100;
|
||||
u32value = u32value < 1 ? 1 : u32value;
|
||||
u32value = u32value > 10 ? 10 : u32value;
|
||||
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value);
|
||||
if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;
|
||||
animation->duration = u32value;
|
||||
|
||||
@@ -20,6 +20,18 @@ static void xtreme_settings_scene_start_asset_pack_changed(VariableItem* item) {
|
||||
app->assets_changed = true;
|
||||
}
|
||||
|
||||
const char* const anim_speed_names[] =
|
||||
{"25%", "50%", "75%", "100%", "125%", "150%", "175%", "200%", "225%", "250%", "275%", "300%"};
|
||||
const int32_t anim_speed_values[COUNT_OF(anim_speed_names)] =
|
||||
{25, 50, 75, 0, 125, 150, 175, 200, 225, 250, 275, 300};
|
||||
static void xtreme_settings_scene_start_anim_speed_changed(VariableItem* item) {
|
||||
XtremeSettingsApp* app = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, anim_speed_names[index]);
|
||||
XTREME_SETTINGS()->anim_speed = anim_speed_values[index];
|
||||
app->settings_changed = true;
|
||||
}
|
||||
|
||||
const char* const cycle_anims_names[] =
|
||||
{"OFF", "Meta.txt", "30 S", "1 M", "5 M", "10 M", "15 M", "30 M", "1 H", "2 H", "6 H", "12 H", "24 H"};
|
||||
const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] =
|
||||
@@ -143,6 +155,17 @@ void xtreme_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, current_pack);
|
||||
variable_item_set_current_value_text(item, current_pack == 0 ? "OFF" : *asset_packs_get(app->asset_packs, current_pack - 1));
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Anim Speed",
|
||||
COUNT_OF(anim_speed_names),
|
||||
xtreme_settings_scene_start_anim_speed_changed,
|
||||
app);
|
||||
value_index = value_index_int32(
|
||||
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_names));
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, anim_speed_names[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Cycle Anims",
|
||||
|
||||
@@ -21,6 +21,7 @@ typedef struct {
|
||||
bool sfw_mode;
|
||||
char asset_pack[MAX_PACK_NAME_LEN];
|
||||
BatteryStyle battery_style;
|
||||
uint16_t anim_speed;
|
||||
} XtremeSettings;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
|
||||
Reference in New Issue
Block a user