potatono

Mar 072010
 

For today’s March Madness program I wanted to try to do something useful with the canvas tag. I decided it would be nice to be able to programmatically generate a background gradient for a web page based on the time of day. If you’re looking at the site in the morning the colors would be different from afternoon, sunset, midnight, etc. I created a hidden canvas tag to do my work and then used the toDataURL method to pass the resulting image to the body’s CSS. Source is below the fold.

Continue reading »

Mar 052010
 

Two programs for you for Thursday night’s entry. A crude Logo interpreter written in Javascript using the HTML5 canvas tag and a quick logo program to go with it. Now when I say crude, I mean crude.

  • You have to separate everything with whitespace because the parser is finicky.
  • All the loops are unrolled so careful with your nesting depth.
  • The only commands supported are the basics: FD, LT, RT, PU, PD and REPEAT.

That said you can still make some fun stuff with it. Source is in the “Read more”.

Continue reading »