Style transform_width/height with transition

When using lv_style_set_transform_width/height in conjunction with a transition animation the time is not honoured for the pressed state.

Tested on simulator with a simple button, changing its width and height when pressed.

7.5.0-dev sync 14th Sept 20

What do you experience?

The button pressed transition occurs immediately (ignoring transition time) but the reverse (released button) transitions correctly. Note: the transform is correct, just the time it takes is off.

What do you expect?

Pressing the button should transform the width/height of the button to the new value over the specified time period.

Code to reproduce

static lv_style_t buttonStyle;
static const lv_style_int_t BUTTON_TRANSITION_TIME = 2000;
static const lv_style_int_t BUTTON_SIZE_OFFSET_ANIM = 10;

lv_obj_t* create_func( lv_obj_t* parent )
    lv_style_init( &buttonStyle );
    lv_style_set_transform_width( &buttonStyle, LV_STATE_PRESSED, BUTTON_SIZE_OFFSET_ANIM );
    lv_style_set_transform_height( &buttonStyle, LV_STATE_PRESSED, BUTTON_SIZE_OFFSET_ANIM );
    lv_style_set_transition_time( &buttonStyle, LV_STATE_PRESSED, BUTTON_TRANSITION_TIME );
    lv_style_set_transition_time( &buttonStyle, LV_STATE_DEFAULT, BUTTON_TRANSITION_TIME );

    lv_style_set_transition_prop_1( &buttonStyle, LV_STATE_PRESSED, LV_STYLE_TRANSFORM_WIDTH );
    lv_style_set_transition_prop_2( &buttonStyle, LV_STATE_PRESSED, LV_STYLE_TRANSFORM_HEIGHT );
    lv_style_set_transition_prop_3( &buttonStyle, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH );
    lv_style_set_transition_prop_4( &buttonStyle, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_HEIGHT );

    lv_obj_t* testButton = lv_btn_create( gauge, NULL );
    lv_obj_reset_style_list( testButton, LV_CONT_PART_MAIN );
    lv_obj_add_style( testButton, LV_BTN_PART_MAIN, &buttonStyle );	

Off the top of my head, you should only need to set the transitions on the default state, though I would need to try this myself to give you an accurate answer.

That’s how I started out but things didn’t work out so I added the PRESSED state, to no effect.

Let me test it and get back to you.

I can’t seem to make it work either. :confused: The example in the docs works fine, but your code doesn’t. I don’t see a big difference between the two.

Glad it’s not just me then.

@kisvegabor Any ideas?

Any further thoughts here or, at the very least, confirmation that this is a bug?

@kisvegabor Could you take a look, please?


Sorry for the late answer. I see that you also opened an issue on GitHub. I’ve already added a fix for this.

For similar issues feel free to open a GitHub issue directly. I check them every day.