微信小程序如何实现弧形红包壳效果

 时间:2024-10-13 22:44:40

1、首先新建个Page类之后,在wxml里面放置底层背景视图,wxss里使用flex弹性布局,并设置好颜色,如下:

微信小程序如何实现弧形红包壳效果

3、在白色背景里面放置一个圆形视图,设置好合适的背景颜色,如下:

微信小程序如何实现弧形红包壳效果

5、设置白色视图的overflow: hidden;将超过白色区域的红色区域剪切掉(overflow表示溢出),如下:

微信小程序如何实现弧形红包壳效果

7、最终实现代码如下:wxml实现:<view class='view-container-bg'>稆糨孝汶;<view class='view-bg-white'><view class='view-bg-arc'></view></view></view>wxss实现:.view-container-bg {background-color: #20C6B7;width: 100%;height: 100vh;display: flex;flex-direction: column;justify-content: center;align-items: center;}.view-bg-white {background-color: white;width: 600rpx;height: 800rpx;border-radius: 10rpx;display: flex;flex-direction: column;align-items: center;overflow: hidden;}.view-bg-arc {background-color: red;width: 660rpx;height: 660rpx;border-radius: 330rpx;margin-top: -350rpx;}

微信小程序如何实现弧形红包壳效果
  • 炸鸡是怎么做的
  • 鲟鱼活体怎么发朋友圈
  • 做自己最重要的事情
  • Scratch如何模拟太阳、地球、月球的运动过程
  • 密室逃脱3—第6关攻略
  • 热门搜索
    背景音乐大全 喉咙里卡了鱼刺怎么办 奥奇传说精灵大全图片 香水怎么制作 怎么治疗脂溢性脱发 阳宅风水图解大全 龙发装饰公司怎么样 商品房过户费怎么算 标志大全 昵称大全女生