We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to implement my Geomerative sketches in processing.js, but running into some trouble. This person had the same query, which apparently got an answer, but I'm not too clued up on this so maybe one of you can expand.
PhiLho says:
"Extract the point information from the font for the characters you need to use, using Geomerative or other means. Save this information on a file. Load the file from JS and use the information."
How would I go about "storing" that information? What format? How? Thanks.
Answers
The person wrote "Using Geomerative, all the points and their coordinates of the text are stored in an array" so my answer was referring to these "points and coordinates". Having not used Geomerative, I don't know how these points and / or coordinates are extracted.
About storing the information: I suppose you can store it as CSV, or as Json, for example.
BTW, I moved the topic to this category, your question isn't "about code" at all, since you show none.
I will have a go at CSV and add some code if I manage. Thanks!
I found an example on supermanoeuvre.com/blog/?p=507 and have managed to get it working in Java mode. Now I'm trying to get the import script to run in Processing.js but it's failing to run, with no errors. If you know what's up please let me know. Thanks!
The export script:
and the import:
In JavaScript Mode, we gotta use JS libraries instead of Java's! :-<
Unless it's cross-mode like the Date class:
http://studio.processingtogether.com/sp/pad/export/ro.9to4yV59zus7B/latest
You're gonna need to search for a corresponding JS library replacement and thus lose Java Mode compatibility! [..]
In this unfortunate case, I recommend you to learn CoffeeScript Mode due to its similarity w/ Java class! *-:)
Maybe I'm not being clear. The geomerative library is not supported, so I'm doing a workaround.
1st program: export (runs in Java mode) Geomerative library to extract RPoint[] from the font to a .csv file.
2nd file: import (processing.js) Read the .csv file and get those PVectors into the sketch. There are no external java libraries here.
But, still no dice. Am I missing something?
You were clear, I think... B-)
Little improvement over your code, a bit pointless as it won't solve your problem, but it shows some useful shortcuts.
Now, back to the issue. Is the CSV file in a data folder inside the sketch folder (the one where the .pde file is)?
You should add some println() to see if the data is correctly loaded.
Thanks for the improvement! I just saw D.Shiffman use that ( : ) syntax in a video a few days ago too. Also, I got the sketch running. Something about the CSV wasn't reading from the HTML file I wrote for it, but it WAS running from Javascript mode from Processing so I just nicked the files (if that makes sense) and bingo.
I was making an improvement too based on this recent thread:
http://forum.processing.org/two/discussion/6503/rollover-within-a-for-loop
But @PhiLho got it 1st! :P I see that's fixed now! Nevertheless, my version: (~~)
/* @pjs preload = "exportedPoints.csv"; pauseOnBlur = "true"; */