-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
我使用网络图片,本地图片。或者 bgcolor 属性设置 Sprite。加上 borderRadius 就会裁剪错。在模拟器上没问题,暂时只在小米5s上遇到了。
测试代码
<template>
<view>
<canvas class="myCanvas" canvas-id="myCanvas" />
</view>
</template>
<script>
import wepy from 'wepy';
const spritejs = require('../../utils/sprite-wxapp');
export default class GenerateImage extends wepy.page {
config = {
navigationBarTitleText: '一起燃烧卡路里',
navigationBarBackgroundColor: '#FA4676'
};
data = {
avatarUrl: 'https://wx.qlogo.cn/mmopen/vi_32/ZrA7SPMNXYibCdRlsTH0oYnfkv0fKx2FVxHfO7MsiaUubIHRtCTp0Ej2f98lvcWVh9wUXuaHAyepWCTYb2HIy8Ug/132'
};
methods = {};
async onLoad() {
let scene = new spritejs.Scene(0);
let layer = scene.layer('myCanvas');
let avatarUrl = await wepy.downloadFile({
url: this.avatarUrl
});
// let avatar = new spritejs.Sprite(avatarUrl.tempFilePath);
let avatar = new spritejs.Sprite();
avatar.attr({
anchor: [0],
pos: [50, 100],
size: [72, 72],
bgcolor: 'red',
borderRadius: 10
});
layer.append(avatar);
}
}
</script>
<style lang="less">
page{
background: #000;
}
.myCanvas {
position: fixed;
left: 0;
top: 0;
height: 1242px;
width: 750px;
}
</style>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed




