Drawing Triangles on the Canvas

by kirupa | 26 October 2014

When you are working with the canvas element in HTML, you have some built-in functions that help you easily draw common shapes like circles, squares, and lines. Guess what shape you don't have a built-in function to help you easily draw?

This is a companion discussion topic for the original entry at http://www.kirupa.com/html5/drawing_triangles_on_the_canvas.htm

Hey there, thanks for the tutorial, you just saved me a lot of work and got things already working. Just out of curiosity -and off-topic-, does the hex value for the yellow in the examples has any relation with the old AltaVista search engine? I know it has nothing to do with the tutorial, I just happen to be very curious about it. As for the rest, you seriously made things simpler for me, thanks!

Hi @carlos_medrano! Welcome to the forums :stuck_out_tongue:

That’s an interesting observation haha. I forgot what the yellow in AltaVista looked like, so here it is in case others are in a similar boat:

I just went with that yellow color since it breaks up the blues and dark text found throughout the site. Maybe subconsciously I was remembering the old AltaVista days! Who knows?


Hahahaha that’s awesome! I asked because it was basically the first color I ever used back in the days -or should I say decades- when AltaVista was a thing and I tried to resemble what was already out there in the market. However, you made a very good point, since it does provides a great contrast with the other colors. Thanks again for the tutorial and I appreciate to be part of your community.

Best regards!

1 Like