Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:56:15+00:00 2026-05-29T22:56:15+00:00

I am using the canvas and HTML5. I have an icon in my canvas

  • 0

I am using the canvas and HTML5. I have an icon in my canvas and a text and when I am trying to add shadow in my Text with this code:

    ctx.shadowColor = textShadowColor;
    ctx.shadowBlur = 1;
    ctx.shadowOffsetX = 1;
    ctx.shadowOffsetY = 1;

the shadow goes also to my image. What could be the problem. As I see this shadowColor goes on the canvas and not really on the text. Should a have different canvas for the text and the image?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:56:16+00:00Added an answer on May 29, 2026 at 10:56 pm

    Are you drawing the text or image first?

    If you’re drawing the image first there should be no problem:

    http://jsfiddle.net/NAanu/

    If you’re drawing the text first you need to clear the shadow so the picture doesn’t get drawn with it also. Here’s an example of drawing the text with a shadow first:

    http://jsfiddle.net/NAanu/1/

    I use save and restore to save and clear the shadow state from the context. You could just set them all to their default values instead, though.


    When you set properties on the context you need to think of it like loading up a paintbrush with paint.

    Setting any context property, like the shadowColor to red is like loading red paint onto the edge of your paintbrush. Anything you paint from then on will have red on it.

    The only way to stop that is to clean your paintbrush (set the color and shadowOffset back to their defaults) or to use save() and restore(), which is saying “remember that my paintbrush was once clear, so later I can recall this clear paintbrush to use again”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm drawing simple text in HTML5 canvas using this: context.fillStyle = #FF0000 context.font =
I have a HTML5-canvas and write text with context.fillText(...); using a @font-face-font. Displaying the
I'm trying to create an animation using HTML5 canvas and Javascript. I have very
I have an html5 canvas drawing application similar to this http://jsfiddle.net/rnNFB/1/ , but using
I am making a game engine using HTML5 canvas, and I have decided to
I have external html5 canvas that you can paint on some lines using your
I have recently created a HTML5 canvas animation (also using Processing.js). The problem is
I am trying to draw in a web worker using html5 canvas. The worker
I have made a game using HTML5 Canvas Element, Javascript for facebook. You can
Is there a way using javascript html5 canvas, to have a polygon and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.