Processing.js and jQuery
Does Processing.js work with jQuery? If so, under wh开发者_开发技巧at circumstances would you choose to use Processing.js?
Processing.js works well with jQuery - remember both languages are abstractions over standard JavaScript, as long as you remember to use the proper naming conventions for variables passed between jQuery and Processing language
for an simple example see: http://processingjs.org/source/ajax-init/index.html
Processing 2.0 API features a Processing.js JavaScript mode, so the combination might not be so confusing to read in that mode.
Yes, processing.js does work with jQuery.
I very recently worked on a processing.js visualization that was updated based on jQuery events. I was able to bind to jQuery events in the processing.js setup() function, and to update variables that were used in the visualization.
One thing to bear in mind is that processing.js has a Java-like syntax, so combining the two languages in this way is confusing to read.
IMO processing.js is better suited to visualizations that require a fine degree of control over the rendering process, and where integration with the DOM is a low priority. Raphael, by comparison, has excellent DOM integration but is much higher level.
精彩评论