html
<camera
mode="normal"
device-position="back"
flash="auto"
binderror="error"
style="width: 100%; height: {{cameraHeight}};">
<cover-view class="imgBox" wx:if="{{idCard}}">
<cover-view class="box">
<cover-view class="line"></cover-view>
</cover-view>
</cover-view>
</camera>
css
.imgBox {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.box {
width: 540rpx;
height: 856rpx;
border: 1rpx solid #2CC8E1;
border-radius: 30rpx;
position: relative;
overflow: hidden;
}
.box .line {
position: absolute;
width: 100rpx;
height: 856rpx;
background: linear-gradient(to left, rgba(44,200,225,0), rgba(44,200,225,.4));
-webkit-animation: 2s linear 0s infinite scan;
animation: 2s linear 0s infinite scan;
}
@keyframes scan {
from { right: -100rpx; } to { right: 600rpx;}
}
想要实现身份证扫描的动画效果
模拟器中效果正常,真机中没有动画,而且扫描线的样式也没有。
你好,可以看下cover-view的注意事项:https://developers.weixin.qq.com/miniprogram/dev/component/cover-view.html