English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML canvas shadowOffsetY Eigenschaft

shadowOffsetY ist eine Eigenschaft von Canvas 2Das D API beschreibt die Eigenschaft, die den vertikalen Abstand des Schattens definiert.

HTML canvas Reference Manual

Online-Beispiel

Zeichnen Sie einen Schatten unterhalb der oberen Kante des Rechtecks20 Pixel breiter Rechteck:

Ihr Browser unterstützt keine HTML5 canvas-Tag.

Verwendung der shadowOffsetY-Eigenschaft:

<!DOCTYPE html>
<html>
<head>
<title>Verwendung der HTML canvas shadowOffsetY-Eigenschaft (Grundtutorials.net oldtoolbag.com)</<title>
</<head>
<body>
<canvas id="myCanvas" width="300" height="150" style="border:1px fest #d3d3d3>
Ihr Browser unterstützt keine 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 it out ‹/›

Browser Compatibility

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.

Definition and Usage

The shadowOffsetY property sets or returns the vertical distance of the shadow from 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 of the shadow from the shape, please use shadowOffsetX Attribute.

Default Value:0
JavaScript Syntax:context.shadowOffsetY=number;

Attribute Value

ValueDescription
numberPositive or negative value, defines the vertical distance of the shadow from the shape.
HTML canvas Reference Manual