derektmueller / purescript-p5 Goto Github PK
View Code? Open in Web Editor NEWp5.js bindings for PureScript
License: MIT License
p5.js bindings for PureScript
License: MIT License
keyPressed in P5 is a function name that should be implemented by the user like setup or draw. Confused by the type signature I found on pursuit, I started browsing this source code and it seems like keyPressed (and similiar functions like keyReleased) are implemented like ordinary callable functions like background or rect.
Since these bindings are still under heavy development I don't know if this is a bug or just not finished yet. If there is interest in that, I will contribute a fix for a bug.
As noted in the TODO section on the Readme:
Would this be the pattern?
-- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont)
loadFont4 :: P5 -> String -> Maybe (Effect Unit) -> Maybe (Effect Unit) -> Font
loadFont4 p5 path callback onError = runFn4 loadFontImpl p5 path callback onError
-- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont)
loadFont3 :: P5 -> String -> Maybe (Effect Unit) -> Font
loadFont3 p5 path callback = runFn4 loadFontImpl p5 path callback Nothing
-- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont)
loadFont2 :: P5 -> String -> Font
loadFont2 p5 path = runFn4 loadFontImpl p5 path Nothing Nothing
Another way would be to omit the necessary first arg 'P5` in the counting :/
The function P5.Image.LoadingAndDisplaying.image
currently has this signature:
image :: P5 -> ElementOrImage -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Effect Unit)
This aligns with the P5 documentation: p5.Image|p5.Element: the image to display
However, it's also possible to draw 'Graphics' to the canvas with this function.
In P5 Graphics are subsumed under the 'base class' Element. Looks weird to me because as far as I understand, a 'graphics' object is not an HTML object, rather some internal representation of a layer on the canvas.
The suggestion would be to have a type GraphicsOrImageOrElement
and change the above image
function to accept this as argument.
Currently it may be a bit annoying for the user to import all the needed modules one by one.
What do you think, would it be a good idea to have re-exports in the P5
module, so that this module is the only one that needs to be imported?
I've just started playing p5. Are you planning to add frameCount
or any idea where would be the best place to add it if I was to send a PR?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.