zoukankan      html  css  js  c++  java
  • SVG-变换

    transform变换

    translate平移

    <svg width="200" height="50">
        <rect x="0" y="0" width="20" height="10" fill="red "/>
        <rect x="0" y="0" width="20" height="10" transform="translate(10, 20)"/>
    </svg>
    

    rotate旋转

    // angle 旋转角度,>0 顺时针
    // [centerX, centerY] 旋转中心点
    rotate(angle, [centerX, centerY]) 
    
    <svg width="200" height="50">
        <rect x="20" y="0" width="20" height="10" fill="red "/>
        <rect x="20" y="0" width="20" height="10" transform="rotate(30)" fill="green"/>
        <rect x="20" y="0" width="20" height="10" transform="rotate(-180, 20, 10)"/>
    </svg>
    

    scale缩放

    // scaleX,scaleY分别表示水平垂直方向的缩放比例,如0.5表示缩小半
    // 若无scaleY则,其值默认等于scaleX
    scale(scaleX [, scaleY]) 
    
    <svg width="200" height="50">
        <rect x="20" y="0" width="20" height="10" fill="red "/>
        <rect x="40" y="0" width="20" height="10" transform="scale(0.8)" fill="green"/>
        <rect x="60" y="0" width="20" height="10" transform="scale(1, 2)"/>
    </svg>
    

    skewXshewY斜切

    skewY(angle)
    skewX(angle)
    
    <svg width="200" height="50">
        <rect x="20" y="0" width="20" height="40" fill="red" transform="skewY(10) skewX(10)"/>
        <rect x="40" y="0" width="20" height="40" fill="green" transform="skewY(10)"/>
        <rect x="60" y="0" width="20" height="40" transform="skewX(10)"/>
    </svg>
    
  • 相关阅读:
    第6课:datetime模块、操作数据库、__name__、redis、mock接口
    第5课:内置函数、处理json、常用模块
    第4课:函数、模块、集合
    第3课:列表和字典的增删改查、字符串常用方法、文件操作
    第2课:jmeter总结、Charles抓包
    第1课:接口测试和jmeter总结
    Centos下找不到eth0设备的解决方法
    Python安装、配置
    改进的SMO算法
    拉普拉斯特征图降维及其python实现
  • 原文地址:https://www.cnblogs.com/fanlinqiang/p/11826125.html
Copyright © 2011-2022 走看看