Mike Chambers

code = joy

Archive for the ‘example’ tag

Timing issues when animating with CSS3 Transitions

with 8 comments

I have been playing around a lot lately with motion graphics created using HTML5 and / or CSS3. One of my favorite new features is CSS Transitions, which makes it super simple to animate element properties between two states.

However, I ran into a gotcha the other day, and wanted to make a quick blog post in case anyone else runs into it in the future. Basically, if you change a property that a CSS Transition is monitoring in the same script loop that you add the element to the DOM, the CSS Transition will not take affect. Instead, the element will be drawn with the new properties, and will not animate to those properties.

Here is an example that shows the issue, as well as how to fix it.
Read the rest of this entry »

Written by mikechambers

July 20th, 2011 at 12:54 pm

Posted in General

Tagged with , , , ,

JavaScript Voronoi port

with 3 comments

I have always been amazed by some of the digital art work that Mario Klingemann (aka @Quasimondo has created using with Voronois. After doing some searching, I found an early ActionScript 1 Voronoi implementation that Mario did, and I ported it to JavaScript.

I wanted to share the results:
Read the rest of this entry »

Written by mikechambers

March 24th, 2011 at 12:19 pm

Posted in General

Tagged with , , , , ,

Example : Creating spiral designs with Canvas, JavaScript and EaselJS

with one comment

I have been having fun playing around with JavaScript, the HTML5 Canvas element and EaselJS lately, and have been building a lot of small experiments. I wanted to share a simple one I created, which creates spiral designs.

 

 

The example was pretty simple to put together, but is fun to play with, and can make some pretty nice patterns / spirals. I have uploaded a couple of images that I have created using the example:
Read the rest of this entry »

Written by mikechambers

February 9th, 2011 at 12:20 am

Posted in General

Tagged with , , , ,

PixelFlow : EaselJS / Canvas Dynamic Graphics Example

with 7 comments

If you have happen to have been watching my Flickr feed for the past week or two, you have probably noticed that I have been playing around with creating some graphics using Canvas and EaselJS. What started as a simple EaselJS experiment, quickly morphed into an excuse to build a mini app / example and play around with some of the new HTML5 and CSS3 features.

PixelFlow

 

The example I created (named PixelFlow) is a simple example / app that allows you to choose an image, and then create some designs using the colors from the image. The core drawing functionality is built about the HTML5 canvas element and the EaselJS library. It also leverages CSS3 transitions and transformation for animating the UI elements (loading and unloading).

You can play around with the example yourself at:
Read the rest of this entry »

Written by mikechambers

February 2nd, 2011 at 10:54 pm

Posted in General

Tagged with , , , , , , ,

Detecting Canvas.toDataURL Support in Browsers

with 2 comments

I am wrapping up a code example that uses the Canvas.toDataURL API to save canvas data to an image. I am almost done, and was doing a final round of browser testing when I noticed that my example wasnt working on my Android based Google Nexus One Device (2.2.2). After some debugging, and then Googling, I discovered that the Canvas.toDataURL API is not implemented on Android (you can view the bug report here).

Well, after some cursing, I put together a simple method for detecting whether the API is supported on any particular device. I wanted to share it in case anyone else might run into a need for it. So, here it is:
Read the rest of this entry »

Written by mikechambers

February 1st, 2011 at 5:09 pm

Posted in General

Tagged with , ,

Setting the background color when generating images from Canvas.toDataURL

without comments

One of the cool features of the HTML5 canvas element is the toDataURL method. This returns a Base64 encoded image in the form of a data url string. Among other things, this can be displayed directly within an IMG element on the page, or sent to the server so the image can be saved.

However, one thing that I found out this weekend is that there is no background color for the image returned from toDataURL. Looking at the actual canvas draft specification, I found this:
Read the rest of this entry »

Written by mikechambers

January 31st, 2011 at 1:37 pm

Posted in General

Tagged with , , ,

Layering Multiple Canvas Elements using JavaScript and EaselJS

without comments

If you run my EaselJS Drone Follow example from yesterday on any non-Android / iOS computer / device, you may notice that a graphic is drawn between the mouse touch point and the current position of the drone. This is done by managing and drawing to two canvas elements and is provided to help make it clear what the drone is following (your mouse) and which direction it is currently heading.

Why use two canvas elements, instead of just drawing to one? Well, there are two primary reasons I architected the example like this.
Read the rest of this entry »

Written by mikechambers

January 25th, 2011 at 12:54 pm

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: