您当前的位置: 首页 >  ar

仙剑情缘

暂无认证

  • 0浏览

    0关注

    333博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

LVLG 8.2 circular scrolling animation of a label

仙剑情缘 发布时间:2022-07-03 10:11:49 ,浏览量:0

创建自定义circular scrolling文本滚动效果
static void lv_example_label_5(void)
{
    static lv_anim_t animation_template;  /动画变量定义
    static lv_style_t label_style;
    lv_anim_init(&animation_template);
    lv_anim_set_delay(&animation_template, 1000); //设置等待1秒开始动画
    lv_anim_set_repeat_delay(&animation_template,
        3000); // 动画回到初时位置后延时3秒重复滚动
        /*Initialize the label style with the animation template*/
    lv_style_init(&label_style);
    lv_style_set_anim(&label_style, &animation_template); // sytle关联动画变量
    lv_obj_t* label1 = lv_label_create(lv_scr_act()); //创建label
    lv_label_set_long_mode(label1, LV_LABEL_LONG_SCROLL_CIRCULAR); //Circular scroll模式
    lv_obj_set_width(label1, 150); // 设置宽度
    lv_label_set_text(label1, "It is a circularly scrolling text. ");//设置文本内容
    lv_obj_align(label1, LV_ALIGN_CENTER, 0, 40);//LV_ALIGN_CENTER方式对齐
    lv_obj_add_style(label1, &label_style, LV_STATE_DEFAULT); //label添加style
}

运行效果

在这里插入图片描述

关注
打赏
1658017818
查看更多评论
立即登录/注册

微信扫码登录

0.0370s