quil / quil-site

Source code of quil.info
http://quil.info
Eclipse Public License 1.0
7 stars 13 forks source link

Adapt quil-site for use with p5js. #25

Closed anthonygalea closed 5 years ago

anthonygalea commented 5 years ago

This pull request is to prepare for adapting quil-site after the migration to p5js. The About tab, Examples tab and Editor seem to work. However:

  1. How do you generate api-2.8.0.clj and snippets-data-2.8.0.clj? Is it running something like this form the quil repo?
(->> as/all-snippets
     (map #(dissoc % :body :setup))
     (clojure.pprint/pprint)
     (with-out-str)
     (spit "snippets-data.clj"))
  1. processing.js had an onFrameEnd hook. Can't find anything like it in p5js. Am I understanding correctly that the purpose of pause-after-next-frame is to render just the first frame of the sketches?
nbeloglazov commented 5 years ago
  1. To generate api.clj you need to run this script. Generating snippets-data is a little bit more involved and described here.

  2. Yes, I stop it after the first frame otherwise running all examples at once requires too much cpu. There are few ways we could address it:

    1. Find similar way to hack into p5js that allows us to call our code at the end of the first frame or between the frames.
      1. Update all examples and add calls to q/no-loop at the end of draw and mark them with ; DELETE string. no-loop will be removed when preparing sketch for showing to user.
      2. Don't do first-frame-preview at all. In which case when user visits http://quil.info/examples there will be just a list of white rectangles and they need to click on each to start.

I'd prefer to do 1 and if it's not possible do 2. I don't like 3 as it will look "empty".

nbeloglazov commented 5 years ago

I'm going to merge this pull request as I want to experiment with 3.0.0 on quil-site (in particular to generate cache for self-hosted cljs).