canvas_15 阴影与透明

canvas_15 阴影与透明

<template>
    <view class="zcvs">

        <view class="zcvs-item">
            <view>Canvas_阴影与透明</view>
            <view>
                <canvas canvas-id="cvs" id="cvs" style="width: 400px; height: 400px;border: 1px solid #007AFF;" />
            </view>

        </view>

    </view>
</template>

<script>
    export default {
        data() {
            return {};
        },
        onReady() {
            this.drawCvs();
        },
        methods: {
            drawCvs() {
                const ctx = uni.createCanvasContext('cvs');
                ctx.setLineWidth(3);

                ctx.beginPath();
                ctx.arc(150, 150, 50, 0, 2 * Math.PI);
                ctx.setFillStyle("#007AFF");
                ctx.fill();

                ctx.setGlobalAlpha(0.5);
                ctx.setShadow(10, 10, 15, "#333");
                ctx.setFillStyle("red");
                ctx.fillRect(150, 150, 100, 100);

                ctx.draw();
            },
        }
    }
</script>

<style lang="scss" scoped></style>

 

上一篇:canvas_21 矩阵变换


下一篇:软件安全问题频现 超150种方法可窃取Android应用权限