<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # SVG 陰影 **注意:** Internet Explorer和Safari不支持SVG濾鏡! ## &lt;defs&gt; 和 &lt;filter&gt; 所有互聯網的SVG濾鏡定義在&lt;defs&gt;元素中。&lt;defs&gt;元素定義短并含有特殊元素(如濾鏡)定義。 &lt;filter&gt;標簽用來定義SVG濾鏡。&lt;filter&gt;標簽使用必需的id屬性來定義向圖形應用哪個濾鏡? ## SVG &lt;feOffset&gt; ## 實例 1 &lt;feOffset&gt;元素是用于創建陰影效果。我們的想法是采取一個SVG圖形(圖像或元素)并移動它在xy平面上一點兒。 第一個例子偏移一個矩形(帶&lt;feOffset&gt;),然后混合偏移圖像頂部(含&lt;feBlend&gt;): ![feoffset](https://box.kancloud.cn/2015-12-17_5672b03cea7b1.gif) 下面是SVG代碼: ## 實例 ``` <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> ? <defs> ??? <filter id="f1" x="0" y="0" width="200%" height="200%"> ????? <feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" /> ????? <feBlend in="SourceGraphic" in2="offOut" mode="normal" /> ??? </filter> ? </defs> ? <rect width="90" height="90" stroke="green" stroke-width="3" ? fill="yellow" filter="url(#f1)" /> </svg> ``` 對于Opera用戶: [查看SVG文件](images/feoffset1.svg)(右鍵單擊SVG圖形預覽源)。 **代碼解析:** * &lt;filter&gt;元素id屬性定義一個濾鏡的唯一名稱 * &lt;rect&gt;元素的濾鏡屬性用來把元素鏈接到"f1"濾鏡 ## 實例 2 現在,偏移圖像可以變的模糊(含 &lt;feGaussianBlur&gt;): ![feoffset2](https://box.kancloud.cn/2015-12-17_5672b03d34d6a.jpg) 下面是SVG代碼: ## 實例 ``` <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> ? <defs> ??? <filter id="f1" x="0" y="0" width="200%" height="200%"> ????? <feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" /> ????? <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" /> ????? <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> ??? </filter> ? </defs> ? <rect width="90" height="90" stroke="green" stroke-width="3" ? fill="yellow" filter="url(#f1)" /> </svg> ``` 對于Opera用戶: [查看SVG文件](images/feoffset2.svg)(右鍵單擊SVG圖形預覽源)。 **代碼解析:** * &lt;feGaussianBlur&gt;元素的stdDeviation屬性定義了模糊量 ## 實例 3 現在,制作一個黑色的陰影: ![feoffset3](https://box.kancloud.cn/2015-12-17_5672b03d7567a.jpg) 下面是SVG代碼: ## 實例 ``` <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> ? <defs> ??? <filter id="f1" x="0" y="0" width="200%" height="200%"> ????? <feOffset result="offOut" in="SourceAlpha" dx="20" dy="20" /> ????? <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" /> ????? <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> ??? </filter> ? </defs> ? <rect width="90" height="90" stroke="green" stroke-width="3" ? fill="yellow" filter="url(#f1)" /> </svg> ``` 對于Opera用戶: [查看SVG文件](images/feoffset3.svg)(右鍵單擊SVG圖形預覽源)。 **代碼解析:** * &lt;feOffset&gt;元素的屬性改為"SourceAlpha"在Alpha通道使用殘影,而不是整個RGBA像素。 ## 實例 4 現在為陰影涂上一層顏色: ![feoffset4](https://box.kancloud.cn/2015-12-17_5672b03d85301.jpg) 下面是SVG代碼: ## 實例 ``` <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> ? <defs> ??? <filter id="f1" x="0" y="0" width="200%" height="200%"> ????? <feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" /> ????? <feColorMatrix result="matrixOut" in="offOut" type="matrix" ????? values="0.2 0 0 0 0 0 0.2 0 0 0 0 0 0.2 0 0 0 0 0 1 0" /> ????? <feGaussianBlur result="blurOut" in="matrixOut" stdDeviation="10" /> ????? <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> ??? </filter> ? </defs> ? <rect width="90" height="90" stroke="green" stroke-width="3" ? fill="yellow" filter="url(#f1)" /> </svg> ``` 對于Opera用戶: [查看SVG文件](images/feoffset4.svg)(右鍵單擊SVG圖形預覽源)。 **代碼解析:** * &lt;feColorMatrix&gt;過濾器是用來轉換偏移的圖像使之更接近黑色的顏色。 '0.2'矩陣的三個值都獲取乘以紅色,綠色和藍色通道。降低其值帶來的顏色至黑色(黑色為0)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看