TagCanvas 2.0

Published

Every now and then I get an email from someone saying that they want to update the list of tags in the cloud using AJAX or plain Javascript. My response has always been “It's a bit tricky, blah blah blah, wait for version 2.” So here is version 2.0, with a new “Update” function for replacing tags while the cloud is in motion:

Example AJAX canvas

To keep things simple, you just have to call TagCanvas.Update('canvasID') and it reloads the list of tags from the same container element that was specified to start with. There is also a new “Reload” function for reloading the tags without attempting to keep their positions.

The changes to make this work involved some serious updates to the way TagCanvas animates things. It will now use requestAnimationFrame (or a prefixed version) if the browser supports it and falls back to using setTimeout otherwise. The interval option is still used as a factor in the speed of the cloud when using requestAnimationFrame to maintain a similar speed with or without it.

The depth option now has a greater effect. Where previously values from 0.1 to 0.8 all looked fairly flat, a value of 0.75 now looks more like what 0.9 gave you before. Values greater than 1 will have even stronger effects, and larger numbers will make things very strange indeed. You could even try a negative depth to get a weird lens-like effect.

The other useful change in this version is support for multi-line tags. Tags will be broken on <br> elements, or you can automatically break tags at a given length by setting the new splitWidth option.

Finally, the jQuery version is now a wrapper around the stand-alone version. This should make it easier for me to keep them both updated without breaking things.

The updated script files are available from the main TagCanvas page.

« Previous: JPEG Saver 4.7 Next: JPEG Saver 4.7.1 »

This site uses cookies - details here.