English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
shadowOffsetY é uma propriedade do Canvas 2A API D descreve a propriedade de distância vertical da sombra.
Desenhar uma sombra na parte inferior do retângulo2retângulo de 0 pixel:
Uso do atributo shadowOffsetY:
!DOCTYPE html> <html> <head> <title>Uso do atributo shadowOffsetY do HTML canvas (Tutorial básico da Web oldtoolbag.com)</title> </head> <body> <canvas id="myCanvas" width="300" height="150" style="border:1px sólido #d3d3d3> Seu navegador não suporta HTML5 canvas tag. </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.shadowBlur=10; ctx.shadowOffsetY=20; ctx.shadowColor="black"; ctx.fillStyle="red"; ctx.fillRect(20,20,100,80); </script> </body> </html>Test see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9Firefox, Opera, Chrome and Safari support the shadowOffsetY attribute.
Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.
The shadowOffsetY attribute sets or returns the vertical distance between the shadow and the shape.
shadowOffsety = 0 indicates that the shadow is exactly behind the shape.
shadowOffsetY = 20 indicates that the shadow starts below the top position of the shape20 pixels.
shadowOffsetY =-20 indicates that the shadow starts above the top position of the shape20 pixels.
Tip:To adjust the horizontal distance between the shadow and the shape, use shadowOffsetX Attribute.
Default value: | 0 |
---|---|
JavaScript syntax: | context.shadowOffsetY=number; |
Value | Description |
---|---|
number | Positive or negative value, defines the vertical distance between the shadow and the shape. |