processing.js

Canvas rotated text artifacts

ぃ、小莉子 提交于 2019-12-01 18:16:29
I use Processing.js to display some 45 degrees rotated text on an image. The problem is that after roation the text becomes hard to read as artifacts become visible, letter spacing is not constant or letters do not have the same bottom line. Here is a demo . You can see that the second "Hello World" has the ‎Ø sign instead of e and o . Also, at 8th the letter spacing problem is obvious. Is there a way to fix this? At least for 45 degrees rotated text. Here's a screenshot. I know that here seems like it's not of a big deal, but the final image has to be perfect and this bug really stands out. I

Canvas rotated text artifacts

ぐ巨炮叔叔 提交于 2019-12-01 17:54:22
问题 I use Processing.js to display some 45 degrees rotated text on an image. The problem is that after roation the text becomes hard to read as artifacts become visible, letter spacing is not constant or letters do not have the same bottom line. Here is a demo. You can see that the second "Hello World" has the ‎Ø sign instead of e and o . Also, at 8th the letter spacing problem is obvious. Is there a way to fix this? At least for 45 degrees rotated text. Here's a screenshot. I know that here

processing.js loading external files

允我心安 提交于 2019-12-01 11:29:37
I want to split my processing.js code into several files but I'm not sure how. I tried doing <script type="application/processing" src="main.pjs"> to load my processing.js file "main.pjs" but it didn't work. Try http://www.hyper-metrix.com/misc/Processing.AJAX.init.zip I know this has already been answered, but I thought I'd add some more explanation: The problem with your initial approach is that the browser does not know what to do with a file of type "application/processing", so it is never even pulled from the server. The init() package that TML posted looks for these and pulls them by

processing.js loading external files

十年热恋 提交于 2019-12-01 08:05:56
问题 I want to split my processing.js code into several files but I'm not sure how. I tried doing <script type="application/processing" src="main.pjs"> to load my processing.js file "main.pjs" but it didn't work. 回答1: Try http://www.hyper-metrix.com/misc/Processing.AJAX.init.zip 回答2: I know this has already been answered, but I thought I'd add some more explanation: The problem with your initial approach is that the browser does not know what to do with a file of type "application/processing", so

Transform screen coordinates to model coordinates

只愿长相守 提交于 2019-12-01 00:21:58
I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance! /Richard Unfortunately for me this required a code modification. I'll look at submitting this to the

Transform screen coordinates to model coordinates

醉酒当歌 提交于 2019-11-30 19:14:35
问题 I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance!

Dynamically “unload” a Processing JS sketch from canvas

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:13:31
问题 I'm using some javascript to allow users to dynamically load a sketch on click to a canvas element using: Processing.loadSketchFromSources('canvas_id', ['sketch.pde']); If I call Processing.loadSketchFromSources(...) a second (or third...) time, it loads a second (or third...) .pde file onto the canvas, which is what I would expect. I'd like for the user to be able to click another link to load a different sketch, effectively unloading the previous one. Is there a method I can call (or a

What is it that stops processings libraries from being used to processing.js

一个人想着一个人 提交于 2019-11-30 07:42:44
问题 For those that don't know, processing is a language/ Java library primarily used for displaying data nice and pretty. Processing.js is its javascript port made by John Resiq. Everything that guy makes is a treasure. As per a previous question I learned that Processing's many libraries would not work in processing.js. Why is this? Processing provides a makeshift compiler that turns the processing code into its javascript equivalent. For context to this question, I'm building a game for a final

Javascript client-data compression

廉价感情. 提交于 2019-11-29 09:55:11
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? See http://rosettacode.org/wiki/LZW_compression#JavaScript for an LZW compression example. It works best on longer strings with repeated patterns. From the Wikipedia article on LZW: A dictionary is initialized to contain the single-character

Exporting a Processing sketch with audio to JavaScript

狂风中的少年 提交于 2019-11-29 08:56:57
How could I implement sound in my Processing sketch that works when I export the sketch to JavaScript? I've written a sketch in Processing that includes two audio (.wav) loops. These loops are played through the Movie class upon mousePressed() and mouseDragged() . The sketch works in normal/Java mode, but does not load when changed to JavaScript mode. The sketch only works in JavaScript mode when I remove the sound. I've noticed that other sketches that use the Movie class as well as sketch examples of libraries such as Minim fail to load when I export them to JavaScript, so I think it's a