Lazy man's flash

 | Javascript | 0 Comments

It's been quite some time since I did any Flash, besides so much has changed since then that I doubt I could make anything spectacular anymore.

However, in the meantime I've been having a look at the new <canvas> tag, which in my opinion does alot of interesting graphics stuff for JavaScript. Nothing super fancy, but fun to play around with anyway.

Here's a simple example that draws two intersecting rectangles, one of which has alpha transparency:


<script type="application/x-javascript">
function draw_rects() {
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");

    ctx.fillStyle = "rgb(200,0,0)";
    ctx.fillRect (10, 10, 55, 50);

    ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
    ctx.fillRect (30, 30, 55, 50);
}
</script>

<canvas id="canvas"></canvas>

 

Some related links:

Leave a comment

Recent Entries

Stupid light-pole
Damn. I bashed in the left side of my car against that stupid light-pole while backing out of the
Enjoy life
The man standing next to me was wearing a fancy suit and carrying a leather briefcase. The next time
Gale-force winds
"The true (golf) pilgrim wanders off to the outlying, the more humble and obscure courses. For it is on
Secret powers
The front nine was quite a display of supernaturally and (almost) perfectly consistent golfing gusto: Par, par, par, par,
No more winter greens
The cool, windy and grayish afternoon calls me onward. It's drizzling on my windshield but I do not care.