processing.js

How do you setup processingJS on html?

本秂侑毒 提交于 2019-12-23 12:12:52
问题 How do you run a processingJS script on an html page? Could someone send me a test .html and any auxiliary code files for me to get an idea? Let's say I wanted to run this rectangle: rect(50,50,50,50); 回答1: Everything you want to know is on this page: JavaScript Quick Start | Processing.js But basically, you need to do create an html file that loads the Processing.js library, then write Processing.js code and load the .pde file into a canvas tag on that page. It looks like this: <!DOCTYPE

How to have multiple processing.js sketches running at the same time

不问归期 提交于 2019-12-22 06:36:02
问题 I'm trying to run multiple sketches on the same page. The init script specifies that: /* * This code searches for all the <script type="application/processing" target="canvasid"> * in your page and loads each script in the target canvas with the proper id. * It is useful to smooth the process of adding Processing code in your page and starting * the Processing.js engine. */ When I specify the target canvas of each sketch, it does not work: <script type="application/processing" target="canvas1

Processing.js array of pictures not showing properly

有些话、适合烂在心里 提交于 2019-12-20 05:58:09
问题 I am trying to take picture path data from my database and show it on the processing sketch like so this is Javascript file: <script type="text/javascript"> function send() { function setPath(d) { var s = d; var processingInstance; if (!processingInstance) { processingInstance = Processing.getInstanceById('canvas'); } processingInstance.change(s); } var variable = 2; $.ajax({ method: "POST", tupe: "POST", url: "take.php", data: ({val: variable}), success: function (data) { $('#msg').html(data

Knowing two points of a rectangle, how can I figure out the other two?

孤者浪人 提交于 2019-12-19 06:00:11
问题 Hey there guys, I'm learning processing.js, and I've come across a mathematical problem, which I can't seem to solve with my limited geometry and trigonometry knowledge or by help of Wikipedia. I need to draw a rectangle. To draw this rectangle, I need to know the coordinate points of each corner. All I know is x and y for the midpoints of the top and bottom of the box, and the length of all four sides. There is no guarantee on the orientation of the box. Any help? This seems like it should

Javascript client-data compression

别说谁变了你拦得住时间么 提交于 2019-12-18 05:54:51
问题 I am trying to develop a paint brush application thru processingjs. This API has function loadPixels() that will load the RGB values in to the array. Now i want to store the array in the server db. The problem is the size of the array, when i convert to a string the size is 5 MB. Is the best solution is to do compression at javascript level? How to do it? 回答1: See http://rosettacode.org/wiki/LZW_compression#JavaScript for an LZW compression example. It works best on longer strings with

What is the processing libraries processing.js can execute?

本小妞迷上赌 提交于 2019-12-13 10:38:53
问题 I want to create socket connection with processing.js. But processing.js can't use java library. Can I use processing.net.* ? And What is the processing libraries processing.js can execute? I can't find the list of libraries. Help me!! 回答1: As far as I know, Processing.JS has no support for Processing libraries. But since it is JavaScript, you can use a framework like jQuery and any libraries for jQuery. As far as socket connections, take a look at Socket.io (http://socket.io/) to connect to

JavaScript Animation will not perform as intended

送分小仙女□ 提交于 2019-12-13 09:28:39
问题 I'm trying to start making a game and while coding the animation for the stickman's legs the animation the legs seem to glitch out and just go from point a to point b when I start the program. Ind I can't figure out what is wrong. Here is my code. var grassY = 370; var bodyX = 200; var ham1X = 220; var ham1Y = 350; var ham2X = 185; var ham2Y = 350; var foot1X = 230; var foot1Y = 365; var foot2X = 165; var foot2Y = 340; var bodyhigh = 315; var bodylow = 340; fill(4, 255, 0); rect(-1,grassY,401

Unfolding for processing 2.1 fails in JavaScript mode

拥有回忆 提交于 2019-12-13 04:36:06
问题 I downloaded the just released Unfolding Maps for Processing 2.1 and the examples work fine in Java mode but fail to run in the JavaScript mode. Is there anything which can be done to make them JavaScript mode compatible? The error I'm getting is uncaught exception: Processing.js: Unable to execute pjs sketch: ReferenceError: UnfoldingMap is not defined 回答1: The technology behind Processing and Processingjs is completely different. A library for Processing/ Java will not work with

Run canvas on background tab

烈酒焚心 提交于 2019-12-12 11:08:05
问题 I have recently created a HTML5 canvas animation (also using Processing.js). The problem is that when I switch the browser to a different tab the animation stops playing. How can I allow the animation to keep playing while the user is on a different tab than the one containing the animation? Example: http://jsfiddle.net/EyFTr/3/ If you switch tabs the clock stops, but if you open the link a new window and blur the window the clock will still move. 回答1: The short answer is you can't. https:/

Processing.js timer

本小妞迷上赌 提交于 2019-12-12 10:59:10
问题 I am developing an application using Processing.js. At each step in the drawing loop I increment the number of frames by one frame++ . I want to know how much time has passed. Currently to get the time passed (knowing that my application is set to run on 60FPS) I do like so: time=frame/60 . But this only works if the application always run at exactly FPS and we all know that's not the case cause it depends on the users hardware. I want the timer to be pretty accurate (having only like 0.0001s