review html5 01:svg

(1)知識點

  • (1.1)什么是svg
  • (1.2)svg的優(yōu)勢
  • (1.3)svg格式(<svg></svg>)

(2)細化

(2.1)什么是svg

  • SVG 指可伸縮矢量圖形 (Scalable Vector Graphics)
  • SVG 用于定義用于網(wǎng)絡的基于矢量的圖形
  • SVG 使用 XML 格式定義圖形
  • SVG 圖像在放大或改變尺寸的情況下其圖形質量不會有損失
  • SVG 是萬維網(wǎng)聯(lián)盟的標準

(2.2)svg的優(yōu)勢

與其他圖像格式相比(比如 JPEG 和 GIF),使用 SVG 的優(yōu)勢在于:

  • SVG 圖像可通過文本編輯器來創(chuàng)建和修改
  • SVG 圖像可被搜索、索引、腳本化或壓縮
  • SVG 是可伸縮的
  • SVG 圖像可在任何的分辨率下被高質量地打印
  • SVG 可在圖像質量不下降的情況下被放大

(3)實踐

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>復習html5 svg</title>
    </head>
    
    <body>

        <svg width="140" height="170">
            <title>貓咪</title>
            <desc>使用svg畫了一個貓咪</desc>
            <!--臉 
                cx:center x 中心點x軸距離,距離左邊框
                cy:center y 中心點y軸距離,距離上邊框
                r:半徑
                stroke:邊框顏色
                fill:填充的顏色
            -->
            <circle cx="70" cy="95" r="50" style="stroke: red; fill: none;" />
            <circle cx="55" cy="80" r="5" style="stroke: black; fill: #339933" />
            <circle cx="85" cy="80" r="5" style="stroke: black; fill: #339933" />
            
            <g id="whiskers">
                <link x1="75" y1="95" x2="135" y2="85" style="stroke: black;" />
                <link x1="75" y1="95" x2="135" y2="105" style="stroke: black;" />
            </g>
            <use xlink:href="#whiskers" transform="scale(-1,1) translate(-140,0)" />
            
            <!-- 耳朵 -->
            <polyline points="108 62, 90 10,70 45, 50 10, 32 62" style="stroke: black; fill: none;" />
            <!-- 嘴 -->
            <polyline points="35 110, 45 120, 95 120, 105 110" style="stroke: black; fill: none;" />
            <!-- 鼻子 -->
            <path d="M 75 90 L 65 90 A 5 10 0 0 0 75 90" style="stroke: black; fill: #ffcccc;" />
            <text x="60" y="165" style="font-family:sans-serif; font-size:14pt;">Cat</text>
        </svg>
    </body>

</html>
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 一、什么是SVG? SVG指可伸縮矢量圖形(Scalable Vector Graphics); SVG用來定義用...
    清心挽風閱讀 1,413評論 1 3
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,269評論 25 708
  • 圖像(image) 常用的圖像文件存儲格式: CDR格式 該格式是CoreDraw軟件專用的一種圖形文件存儲格式;...
    我才不是稻草人閱讀 1,666評論 0 0
  • Android自定義動畫三-SVG動畫 本篇文章主要是對SVG的一個介紹和使用,以及Android中對SVG的一個...
    OpenCoder閱讀 2,160評論 0 9
  • 不知從何時起, 我的世界變得一片枯寂。 那雜草叢生的陰郁下, 埋藏著一塊塊瓦礫。 我試著踮起腳碰觸陽光, 可溫暖的...
    墨小凝閱讀 364評論 2 1