canvas_20 旋转

canvas_20 旋转

<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.setFillStyle("#007AFF");

                ctx.beginPath();
                ctx.translate(200, 0);
                ctx.rotate(30 * Math.PI / 180);
                ctx.fillRect(0, 0, 100, 100);

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

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

 

canvas_20 旋转

上一篇:实验六:Linux命令进阶篇之一


下一篇:Screen Snapshot for Mac(高效屏幕截图工具) v5.3.0激活版