Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

3.4. Style

Black is so last season. If only there was a way to change the color of our shapes and lines. Wait, there is? And it's really easy? Like one line of code easy? Awesome! I';m not lying about it being easy by the way. Let's jump straight in and change the color of the square we made at the beginning of the chapter.

context.fillStyle = "rgb(255, 0, 0)";
context.fillRect(40, 40, 100, 100);


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint