HTML5 concise tutorial-1.1.1.HTML5Canvas reference manual shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, html5shadowcolor

Source: Internet
Author: User

HTML5 concise tutorial-1.1.1.HTML5Canvas reference manual shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, html5shadowcolor

Link: http://blog.csdn.net/tomorrow13210073213/article/details/42386597

Indicate the source for reprinting.


The HTML5 canvas provides the element shadow function. Its main attributes include shadowColor, shadowBlur, shadowOffsetX, and shadowOffsetY. ShadowColor defines the shadowColor style, shadowBlur defines the shadow blur coefficient, shadowOffsetX defines the Shadow X axis offset, and shadowOffsetY defines the shadow Y axis offset.

The canvas attributes mentioned above are shadow-related and are not described separately.


Property 1: shadowColor

Property name: shadowColor

Property Description: Specifies the shadowColor attribute or returns the color of the shadow.

Default attribute value: #000000

Property Value: color value. Only color values (Color Words, #000000, rgba) can be defined.

Js Syntax: context. shadowColor = color;


Note: After shadowColor is defined, at least shadowBlur must be used to define the shadowColor blur coefficient. Otherwise, the shadowBlur will not be able to see the shadowColor effect.


Property 2: shadowBlur

Property name: shadowBlur

Property Description: shadowBlur attribute setting or return the Blur coefficient of the shadow.

Default attribute value: 0, not fuzzy

Attribute Value: Number.

Js Syntax: context. shadowBlur = number;


Note: As mentioned above, after shadowColor is defined, at least shadowBlur must be used to define the shadowBlur; otherwise, the shadowColor effect will not be displayed.


Attribute 3: shadowOffsetX

Property name: shadowOffsetX

Property Description: The shadowOffsetX Property sets or returns the horizontal distance between the shape and the shadow, or the X axis offset.

Default attribute value: 0. The shadow is not offset and is located at the bottom of the element.

Attribute Value: Number.

Js Syntax: context. shadowOffsetX = number;

Parameter Value: number defaults to 0 (not offset, located at the bottom of the element), positive (offset to the positive direction of the X axis), and negative (offset to the negative direction of the X axis ).


Attribute 4: shadowOffsetY

Property name: shadowOffsetY

Property Description: The shadowOffsetY Property sets or returns the vertical distance between the shape and the shadow, or the Y axis offset.

Default attribute value: 0. The shadow is not offset and is located at the bottom of the element.

Attribute Value: Number.

Js Syntax: context. shadowOffsetY = number;

Parameter Value: number defaults to 0 (not offset, located at the bottom of the element), positive (offset to the positive side of the Y axis), and negative (offset to the negative side of the Y axis ).


Shadow-related attributes are relatively simple and will not be described in detail. Only the relevant test code is posted as follows:


The test code is as follows:

<! DOCTYPE html> The running effect is as follows:



Link: http://blog.csdn.net/tomorrow13210073213/article/details/42386597

Indicate the source for reprinting.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.