├── .gitignore ├── .nvmrc ├── LICENSE ├── README.md ├── bin └── watch ├── bower.json ├── examples ├── acceleration-events │ ├── AccelerationEvents.purs │ ├── index.html │ └── index.js ├── basic │ ├── Main.purs │ ├── index.html │ └── index.js ├── frame-count │ ├── FrameCount.purs │ ├── index.html │ └── index.js ├── hello-p5-simple-shapes │ ├── HelloP5SimpleShapes.purs │ ├── index.html │ └── index.js ├── image-load-and-display-image │ ├── ImageLoadAndDisplayImage.purs │ ├── index.html │ ├── index.js │ └── moonwalk.jpg ├── keyboard-events │ ├── KeyboardEvents.purs │ ├── index.html │ └── index.js ├── l-systems │ ├── LSystems.purs │ ├── index.html │ └── index.js ├── mouse-events │ ├── MouseEvents.purs │ ├── index.html │ └── index.js ├── structure-width-and-height │ ├── StructureWidthAndHeight.purs │ ├── index.html │ └── index.js └── touch-events │ ├── TouchEvents.purs │ ├── index.html │ └── index.js ├── generated-docs ├── Main.md ├── P5.md └── P5 │ ├── Color.md │ ├── Color │ ├── CreatingAndReading.md │ └── Setting.md │ ├── Data.md │ ├── Data │ ├── Conversion.md │ ├── Dictionary.md │ └── StringFunctions.md │ ├── Environment.md │ ├── Environment │ └── Environment.md │ ├── Events.md │ ├── Events │ ├── Acceleration.md │ ├── Keyboard.md │ ├── Mouse.md │ └── Touch.md │ ├── Generated.md │ ├── IO.md │ ├── IO │ ├── Input.md │ ├── Output.md │ └── TimeAndDate.md │ ├── Image.md │ ├── Image │ ├── Image.md │ ├── LoadingAndDisplaying.md │ └── Pixels.md │ ├── LightsAndCamera.md │ ├── LightsAndCamera │ ├── Camera.md │ ├── Interaction.md │ ├── Lights.md │ └── Material.md │ ├── Math.md │ ├── Math │ ├── Calculation.md │ ├── Math.md │ ├── Noise.md │ ├── Random.md │ └── Trigonometry.md │ ├── Rendering.md │ ├── Rendering │ └── Rendering.md │ ├── Shape.md │ ├── Shape │ ├── Attributes.md │ ├── Curves.md │ ├── ThreeDModels.md │ ├── ThreeDPrimitives.md │ ├── TwoDPrimitives.md │ └── Vertex.md │ ├── Structure.md │ ├── Structure │ └── Structure.md │ ├── Transform.md │ ├── Transform │ └── Transform.md │ ├── Types.md │ ├── Types │ ├── Color.md │ └── Image.md │ ├── Typography.md │ └── Typography │ ├── Attributes.md │ └── LoadingAndDisplaying.md ├── package-lock.json ├── package.json ├── snapshots ├── helloP5SimpleShapes ├── lSystems ├── lineDrawing └── structureWidthAndHeight ├── src ├── P5.js ├── P5.purs └── P5 │ ├── Color.js │ ├── Color.purs │ ├── Color │ ├── CreatingAndReading.js │ ├── CreatingAndReading.purs │ ├── Setting.js │ └── Setting.purs │ ├── Data.js │ ├── Data.purs │ ├── Data │ ├── Conversion.js │ ├── Conversion.purs │ ├── Dictionary.js │ ├── Dictionary.purs │ ├── StringFunctions.js │ └── StringFunctions.purs │ ├── Environment.js │ ├── Environment.purs │ ├── Events.js │ ├── Events.purs │ ├── Events │ ├── Acceleration.js │ ├── Acceleration.purs │ ├── Keyboard.js │ ├── Keyboard.purs │ ├── Mouse.js │ ├── Mouse.purs │ ├── Touch.js │ └── Touch.purs │ ├── IO.js │ ├── IO.purs │ ├── IO │ ├── Input.js │ ├── Input.purs │ ├── Output.js │ ├── Output.purs │ ├── TimeAndDate.js │ └── TimeAndDate.purs │ ├── Image.js │ ├── Image.purs │ ├── Image │ ├── LoadingAndDisplaying.js │ ├── LoadingAndDisplaying.purs │ ├── Pixels.js │ └── Pixels.purs │ ├── LightsAndCamera.js │ ├── LightsAndCamera.purs │ ├── LightsAndCamera │ ├── Camera.js │ ├── Camera.purs │ ├── Interaction.js │ ├── Interaction.purs │ ├── Lights.js │ ├── Lights.purs │ ├── Material.js │ └── Material.purs │ ├── Math.js │ ├── Math.purs │ ├── Math │ ├── Calculation.js │ ├── Calculation.purs │ ├── Noise.js │ ├── Noise.purs │ ├── Random.js │ ├── Random.purs │ ├── Trigonometry.js │ └── Trigonometry.purs │ ├── Rendering.js │ ├── Rendering.purs │ ├── Shape.js │ ├── Shape.purs │ ├── Shape │ ├── Attributes.js │ ├── Attributes.purs │ ├── Curves.js │ ├── Curves.purs │ ├── ThreeDModels.js │ ├── ThreeDModels.purs │ ├── ThreeDPrimitives.js │ ├── ThreeDPrimitives.purs │ ├── TwoDPrimitives.js │ ├── TwoDPrimitives.purs │ ├── Vertex.js │ └── Vertex.purs │ ├── Structure.js │ ├── Structure.purs │ ├── Transform.js │ ├── Transform.purs │ ├── Types.purs │ ├── Types │ ├── Color.js │ ├── Color.purs │ ├── Image.js │ └── Image.purs │ ├── Typography.js │ ├── Typography.purs │ └── Typography │ ├── Attributes.js │ ├── Attributes.purs │ ├── LoadingAndDisplaying.js │ └── LoadingAndDisplaying.purs ├── test └── Main.purs ├── unsupported.md ├── webpack-dll.config.js └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | /bower_components/ 2 | /node_modules/ 3 | /.pulp-cache/ 4 | /output/ 5 | /.psc-package/ 6 | /.psc* 7 | /.purs* 8 | /.psa* 9 | /dist 10 | /TODO 11 | /vendor-dll.js 12 | /vendor-manifest.json 13 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 10.16.3 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Derek Mueller 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # purescript-p5 2 | 3 | p5.js bindings for PureScript 4 | 5 | *Disclaimer: This project has just been started and the API is still very unstable.* 6 | 7 | ## Documentation 8 | 9 | Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-p5). 10 | 11 | purescript-p5 implements a subset of the p5.js API (see [Project Status](#project-status)). 12 | 13 | ## Installation 14 | 15 | ``` 16 | bower install purescript-p5 17 | ``` 18 | 19 | This library depends on p5.js. This dependency may be satisfied by installing the NPM [p5.js package](https://www.npmjs.com/package/p5). 20 | 21 | ``` 22 | npm install p5 --save 23 | ``` 24 | 25 | ## Running the examples 26 | 27 | The examples use the webpack DLLPlugin to improve build performance. To run the examples, first build the dll bundle with: 28 | 29 | ``` 30 | npm run webpack:dll 31 | ``` 32 | 33 | This creates a separate webpack bundle for dependencies so that they don't need to be regenerated each time the app is changed. 34 | 35 | To start webpack dev server, run: 36 | 37 | ``` 38 | npm run webpack:server 39 | ``` 40 | 41 | With webpack dev server running, examples can be viewed in a browser by visiting ```localhost:4008/examples/path-to-example```. 42 | 43 | ## Project Status 44 | 45 | Completed: 46 | * wrappers for most methods defined on the p5 class 47 | 48 | TODO: 49 | * generate methods for classes other than p5 (e.g. p5.Vector, p5.Image) 50 | * create easier-to-use interfaces for functions with numeric suffixes 51 | * use Reader monad to implicitly pass the p5 argument 52 | 53 | ## References 54 | 55 | Many of the examples are based on the p5.js examples on the [p5.js reference site](https://p5js.org/examples/), and are licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/). 56 | 57 | -------------------------------------------------------------------------------- /bin/watch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while true; do 4 | change=$(inotifywait -r -e close_write,moved_to,create ./src/P5 ./src ./test) 5 | pulp test --include examples 6 | done 7 | 8 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "purescript-p5", 3 | "authors": [ 4 | "Derek Mueller " 5 | ], 6 | "description": "p5.js bindings", 7 | "license": "MIT", 8 | "ignore": [ 9 | "**/.*", 10 | "node_modules", 11 | "bower_components", 12 | "output" 13 | ], 14 | "repository": { 15 | "type": "git", 16 | "url": "git://github.com/parenparen/purescript-p5.git" 17 | }, 18 | "dependencies": { 19 | "purescript-prelude": "^4.1.0", 20 | "purescript-console": "^4.1.0", 21 | "purescript-effect": "^2.0.0", 22 | "purescript-functions": "^4.0.0", 23 | "purescript-node-fs": "^5.0.0", 24 | "purescript-foreign": "^5.0.0", 25 | "purescript-foreign-generic": "^7.0.0", 26 | "purescript-debug": "^4.0.0", 27 | "purescript-stringutils": "^0.0.8", 28 | "purescript-quickcheck": "^5.0.0", 29 | "purescript-canvas": "^4.0.0", 30 | "purescript-aff": "^5.0.2" 31 | }, 32 | "devDependencies": { 33 | "purescript-psci-support": "^4.0.0", 34 | "purescript-spec": "^3.0.0", 35 | "purescript-now": "^4.0.0", 36 | "purescript-jsdom-global": "https://github.com/parenparen/purescript-jsdom-global.git#0.1.0", 37 | "purescript-web-html": "^1.2.0", 38 | "purescript-crypto": "^1.1.0", 39 | "purescript-inflection": "^1.0.0" 40 | }, 41 | "resolutions": { 42 | "purescript-jsdom-global": "0.1.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /examples/acceleration-events/AccelerationEvents.purs: -------------------------------------------------------------------------------- 1 | module AccelerationEvents where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Environment 15 | import P5.Rendering 16 | import P5.Events.Acceleration 17 | 18 | type AppState = { 19 | p5 :: P5 20 | } 21 | 22 | initialState :: Maybe AppState 23 | initialState = Nothing 24 | 25 | main :: Maybe AppState -> Effect (Maybe AppState) 26 | main mAppState = do 27 | win <- window 28 | w <- toNumber <$> innerWidth win 29 | h <- toNumber <$> innerHeight win 30 | p <- maybe getP5 (\x -> pure x.p5) mAppState 31 | 32 | deviceMoved p do 33 | log "device moved" 34 | pure unit 35 | 36 | deviceShaken p do 37 | log "device shaken" 38 | pure unit 39 | 40 | deviceTurned p do 41 | log "device turned" 42 | pure unit 43 | 44 | setup p do 45 | _ <- createCanvas p w h Nothing 46 | pure unit 47 | 48 | pure $ Just { p5: p } 49 | -------------------------------------------------------------------------------- /examples/acceleration-events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | this text cannot be selected by double-tapping because the touchStarted event handler returns false 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/acceleration-events/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./AccelerationEvents.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/basic/Main.purs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Data 15 | import P5.Environment 16 | import P5.Events 17 | import P5.IO 18 | import P5.Image 19 | import P5.LightsAndCamera 20 | import P5.Math 21 | import P5.Rendering 22 | import P5.Shape 23 | import P5.Structure 24 | import P5.Transform 25 | import P5.Typography 26 | 27 | type AppState = { 28 | p5 :: P5 29 | } 30 | 31 | initialState :: Maybe AppState 32 | initialState = Nothing 33 | 34 | main :: Maybe AppState -> Effect (Maybe AppState) 35 | main mAppState = do 36 | win <- window 37 | w <- toNumber <$> innerWidth win 38 | h <- toNumber <$> innerHeight win 39 | p <- maybe getP5 (\x -> pure x.p5) mAppState 40 | 41 | let palette = 42 | { a: "#4d0c40" 43 | , b: "#a11a23" 44 | , c: "#b29179" 45 | , d: "#c0a476" 46 | , e: "#9d7f38" 47 | } 48 | setup p do 49 | _ <- createCanvas p w h Nothing 50 | pure unit 51 | 52 | draw p do 53 | background3 p palette.b Nothing 54 | stroke p palette.a 55 | strokeWeight p 5.0 56 | rect p 100.0 100.0 50.0 50.0 Nothing Nothing 57 | rect p 110.0 110.0 50.0 50.0 Nothing Nothing 58 | pure unit 59 | 60 | pure $ Just { p5: p } 61 | -------------------------------------------------------------------------------- /examples/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/basic/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./Main.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/frame-count/FrameCount.purs: -------------------------------------------------------------------------------- 1 | module FrameCount where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Environment 15 | import P5.Rendering 16 | 17 | type AppState = { 18 | p5 :: P5 19 | } 20 | 21 | initialState :: Maybe AppState 22 | initialState = Nothing 23 | 24 | main :: Maybe AppState -> Effect (Maybe AppState) 25 | main mAppState = do 26 | win <- window 27 | w <- toNumber <$> innerWidth win 28 | h <- toNumber <$> innerHeight win 29 | p <- maybe getP5 (\x -> pure x.p5) mAppState 30 | 31 | setup p do 32 | _ <- createCanvas p w h Nothing 33 | pure unit 34 | 35 | draw p do 36 | background3 p "gray" Nothing 37 | n <- frameCount p 38 | log $ show n 39 | pure unit 40 | 41 | pure $ Just { p5: p } 42 | -------------------------------------------------------------------------------- /examples/frame-count/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/frame-count/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./FrameCount.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/hello-p5-simple-shapes/HelloP5SimpleShapes.purs: -------------------------------------------------------------------------------- 1 | module HelloP5SimpleShapes where 2 | 3 | -- based on https://p5js.org/examples/hello-p5-simple-shapes.html 4 | -- https://creativecommons.org/licenses/by-nc-sa/4.0/ 5 | 6 | import Prelude 7 | import Effect (Effect) 8 | import Effect.Console (log) 9 | import Data.Maybe (Maybe(..), maybe) 10 | import Data.Int (toNumber) 11 | import Data.Enum 12 | import Data.Array 13 | import Data.Tuple 14 | import Data.Unfoldable 15 | import Data.Traversable 16 | import Web.HTML (window) 17 | import Web.HTML.Window (innerWidth, innerHeight) 18 | 19 | import P5 20 | import P5.Color 21 | import P5.Data 22 | import P5.Environment 23 | import P5.Events 24 | import P5.IO 25 | import P5.Image 26 | import P5.LightsAndCamera 27 | import P5.Math 28 | import P5.Rendering 29 | import P5.Shape 30 | import P5.Structure 31 | import P5.Transform 32 | import P5.Typography 33 | 34 | import Data.Enum 35 | import Math (pi) 36 | 37 | type AppState = { 38 | p5 :: P5 39 | } 40 | 41 | initialState :: Maybe AppState 42 | initialState = Nothing 43 | 44 | drawExample :: P5 -> Effect Unit 45 | drawExample p = do 46 | resetMatrix p 47 | background4 p 200.0 Nothing 48 | fill5 p 204.0 101.0 192.0 (Just 127.0) 49 | stroke5 p 127.0 63.0 120.0 Nothing 50 | rect p 40.0 120.0 120.0 40.0 Nothing Nothing 51 | ellipse p 240.0 240.0 80.0 (Just 80.0) 52 | triangle p 300.0 100.0 320.0 100.0 310.0 80.0 53 | translate2 p 580.0 200.0 Nothing 54 | noStroke p 55 | 56 | _ <- traverse 57 | (\_ -> do 58 | ellipse p 0.0 30.0 20.0 (Just 80.0) 59 | rotate p (pi / 5.0) Nothing 60 | ) 61 | (enumFromTo 0 9) :: Effect (Array Unit) 62 | 63 | pure unit 64 | 65 | main :: Maybe AppState -> Effect (Maybe AppState) 66 | main mAppState = do 67 | let w = 720 68 | h = 400 69 | p <- maybe getP5 (\x -> pure x.p5) mAppState 70 | 71 | case mAppState of 72 | Nothing -> 73 | setup p do 74 | e <- createCanvas p (toNumber w) (toNumber h) Nothing 75 | setId e "helloP5SimpleShapes" 76 | drawExample p 77 | pure unit 78 | _ -> drawExample p 79 | 80 | pure $ Just { p5: p } 81 | -------------------------------------------------------------------------------- /examples/hello-p5-simple-shapes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/hello-p5-simple-shapes/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./HelloP5SimpleShapes.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/image-load-and-display-image/ImageLoadAndDisplayImage.purs: -------------------------------------------------------------------------------- 1 | module ImageLoadingAndDisplayImage where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($), (/), (<>)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Types.Image as Image 15 | import P5.Environment 16 | import P5.Rendering 17 | import P5.Image.LoadingAndDisplaying 18 | 19 | type AppState = { 20 | p5 :: P5 21 | } 22 | 23 | initialState :: Maybe AppState 24 | initialState = Nothing 25 | 26 | main :: Maybe AppState -> Effect (Maybe AppState) 27 | main mAppState = do 28 | win <- window 29 | let w = 720.0 30 | h = 400.0 31 | p <- maybe getP5 (\x -> pure x.p5) mAppState 32 | 33 | setup p do 34 | _ <- createCanvas p w h Nothing 35 | pure unit 36 | 37 | draw p do 38 | let successCallback = \img -> do 39 | log $ "image loaded (" <> show (Image.width p img) <> " x " 40 | <> show (Image.height p img) <> ")" 41 | img = loadImage p "moonwalk.jpg" (Just successCallback) Nothing 42 | image p (ElementOrImageImage img) 0.0 0.0 Nothing Nothing 43 | image p (ElementOrImageImage img) 0.0 ((height p) / 2.0) 44 | (Just ((Image.width p img) / 2.0)) 45 | (Just ((Image.height p img) / 2.0)) 46 | pure unit 47 | 48 | pure $ Just { p5: p } 49 | -------------------------------------------------------------------------------- /examples/image-load-and-display-image/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/image-load-and-display-image/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./ImageLoadAndDisplayImage.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/image-load-and-display-image/moonwalk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derektmueller/purescript-p5/a2d0e44f18e39c274ec79b4cfb87731016d86358/examples/image-load-and-display-image/moonwalk.jpg -------------------------------------------------------------------------------- /examples/keyboard-events/KeyboardEvents.purs: -------------------------------------------------------------------------------- 1 | module KeyboardEvents where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Environment 15 | import P5.Rendering 16 | import P5.Events.Keyboard 17 | 18 | type AppState = { 19 | p5 :: P5 20 | } 21 | 22 | initialState :: Maybe AppState 23 | initialState = Nothing 24 | 25 | main :: Maybe AppState -> Effect (Maybe AppState) 26 | main mAppState = do 27 | win <- window 28 | w <- toNumber <$> innerWidth win 29 | h <- toNumber <$> innerHeight win 30 | p <- maybe getP5 (\x -> pure x.p5) mAppState 31 | 32 | keyPressed p do 33 | log "key pressed" 34 | pure false 35 | 36 | keyReleased p do 37 | log "key released" 38 | pure true 39 | 40 | keyTyped p do 41 | log "key typed" 42 | pure true 43 | 44 | setup p do 45 | _ <- createCanvas p w h Nothing 46 | pure unit 47 | 48 | pure $ Just { p5: p } 49 | -------------------------------------------------------------------------------- /examples/keyboard-events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | characters cannot be typed in this input box because the event handler for keyPressed returns false 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/keyboard-events/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./KeyboardEvents.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/l-systems/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/l-systems/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./LSystems.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/mouse-events/MouseEvents.purs: -------------------------------------------------------------------------------- 1 | module MouseEvents where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Environment 15 | import P5.Rendering 16 | import P5.Events.Mouse 17 | 18 | type AppState = { 19 | p5 :: P5 20 | } 21 | 22 | initialState :: Maybe AppState 23 | initialState = Nothing 24 | 25 | main :: Maybe AppState -> Effect (Maybe AppState) 26 | main mAppState = do 27 | win <- window 28 | w <- toNumber <$> innerWidth win 29 | h <- toNumber <$> innerHeight win 30 | p <- maybe getP5 (\x -> pure x.p5) mAppState 31 | 32 | mouseMoved p do 33 | log "mouse moved" 34 | pure true 35 | 36 | mouseDragged p do 37 | log "mouse dragged" 38 | pure true 39 | 40 | mousePressed p do 41 | log "mouse pressed" 42 | pure false 43 | 44 | mouseReleased p do 45 | log "mouse released" 46 | pure true 47 | 48 | mouseClicked p do 49 | log "mouse clicked" 50 | pure true 51 | 52 | setup p do 53 | _ <- createCanvas p w h Nothing 54 | pure unit 55 | 56 | pure $ Just { p5: p } 57 | -------------------------------------------------------------------------------- /examples/mouse-events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | this text cannot be selected by double-clicking because the mousePressed event handler returns false 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/mouse-events/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./MouseEvents.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/structure-width-and-height/StructureWidthAndHeight.purs: -------------------------------------------------------------------------------- 1 | module StructureWidthAndHeight where 2 | 3 | -- based on https://p5js.org/examples/structure-width-and-height.html 4 | -- https://creativecommons.org/licenses/by-nc-sa/4.0/ 5 | 6 | import Prelude 7 | import Effect (Effect) 8 | import Effect.Console (log) 9 | import Data.Maybe (Maybe(..), maybe) 10 | import Data.Int (toNumber) 11 | import Data.Enum 12 | import Data.Array 13 | import Data.Tuple 14 | import Data.Unfoldable 15 | import Data.Traversable 16 | import Web.HTML (window) 17 | import Web.HTML.Window (innerWidth, innerHeight) 18 | import P5 19 | import P5.Color 20 | import P5.Data 21 | import P5.Environment 22 | import P5.Events 23 | import P5.IO 24 | import P5.LightsAndCamera 25 | import P5.Math 26 | import P5.Rendering 27 | import P5.Shape 28 | import P5.Structure 29 | import P5.Transform 30 | import P5.Typography 31 | 32 | type AppState = { 33 | p5 :: P5 34 | } 35 | 36 | initialState :: Maybe AppState 37 | initialState = Nothing 38 | 39 | enumFromThenTo :: Int -> Int -> Int -> Array Int 40 | enumFromThenTo a b c = 41 | a 42 | : unfoldr 43 | (\a' -> let next = a' + (b - a) in 44 | if next < c then Just (Tuple next next) else Nothing) a 45 | 46 | main :: Maybe AppState -> Effect (Maybe AppState) 47 | main mAppState = do 48 | let w = 720 49 | h = 400 50 | p <- maybe getP5 (\x -> pure x.p5) mAppState 51 | 52 | setup p do 53 | e <- createCanvas p (toNumber w) (toNumber h) Nothing 54 | setId e "structureWidthAndHeight" 55 | pure unit 56 | 57 | draw p do 58 | background4 p 127.0 Nothing 59 | noStroke p 60 | 61 | _ <- traverse (\i -> do 62 | fill5 p 129.0 206.0 15.0 Nothing 63 | rect p 0.0 (toNumber i) (toNumber w) 10.0 Nothing Nothing 64 | fill4 p 255.0 Nothing 65 | rect p (toNumber i) 0.0 10.0 (toNumber h) Nothing Nothing 66 | ) (enumFromThenTo 0 20 h) 67 | 68 | pure unit 69 | 70 | pure $ Just { p5: p } 71 | -------------------------------------------------------------------------------- /examples/structure-width-and-height/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/structure-width-and-height/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./StructureWidthAndHeight.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /examples/touch-events/TouchEvents.purs: -------------------------------------------------------------------------------- 1 | module TouchEvents where 2 | 3 | import Prelude 4 | (Unit, show, bind, (<$>), pure, discard, unit, ($)) 5 | import Effect (Effect) 6 | import Effect.Console (log) 7 | import Data.Maybe (Maybe(..), maybe) 8 | import Data.Int (toNumber) 9 | import Web.HTML (window) 10 | import Web.HTML.Window (innerWidth, innerHeight) 11 | 12 | import P5 13 | import P5.Color 14 | import P5.Environment 15 | import P5.Rendering 16 | import P5.Events.Touch 17 | 18 | type AppState = { 19 | p5 :: P5 20 | } 21 | 22 | initialState :: Maybe AppState 23 | initialState = Nothing 24 | 25 | main :: Maybe AppState -> Effect (Maybe AppState) 26 | main mAppState = do 27 | win <- window 28 | w <- toNumber <$> innerWidth win 29 | h <- toNumber <$> innerHeight win 30 | p <- maybe getP5 (\x -> pure x.p5) mAppState 31 | 32 | touchStarted p do 33 | log "touch started" 34 | pure false 35 | 36 | touchMoved p do 37 | log "touch moved" 38 | pure true 39 | 40 | touchEnded p do 41 | log "touch ended" 42 | pure true 43 | 44 | setup p do 45 | _ <- createCanvas p w h Nothing 46 | pure unit 47 | 48 | pure $ Just { p5: p } 49 | -------------------------------------------------------------------------------- /examples/touch-events/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 15 | 16 | this text cannot be selected by double-tapping because the touchStarted event handler returns false 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/touch-events/index.js: -------------------------------------------------------------------------------- 1 | const App = require('./TouchEvents.purs'); 2 | 3 | window.__appState = App.main(window.__appState || App.initialState)(); 4 | module.hot.accept(); 5 | -------------------------------------------------------------------------------- /generated-docs/Main.md: -------------------------------------------------------------------------------- 1 | ## Module Main 2 | 3 | #### `main` 4 | 5 | ``` purescript 6 | main :: Unit 7 | ``` 8 | 9 | 10 | -------------------------------------------------------------------------------- /generated-docs/P5/Color/CreatingAndReading.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Color.CreatingAndReading 2 | 3 | #### `alpha` 4 | 5 | ``` purescript 6 | alpha :: P5 -> ArrayNumberOrStringOrColor -> Number 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/alpha) 10 | 11 | #### `blue` 12 | 13 | ``` purescript 14 | blue :: P5 -> ArrayNumberOrStringOrColor -> Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/blue) 18 | 19 | #### `brightness` 20 | 21 | ``` purescript 22 | brightness :: P5 -> ArrayNumberOrStringOrColor -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/brightness) 26 | 27 | #### `color` 28 | 29 | ``` purescript 30 | color :: P5 -> String -> Color 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/color) 34 | 35 | #### `color2` 36 | 37 | ``` purescript 38 | color2 :: P5 -> (Array Number) -> Color 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/color) 42 | 43 | #### `color3` 44 | 45 | ``` purescript 46 | color3 :: P5 -> Color -> Color 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/color) 50 | 51 | #### `color4` 52 | 53 | ``` purescript 54 | color4 :: P5 -> Number -> (Maybe Number) -> Color 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/color) 58 | 59 | #### `color5` 60 | 61 | ``` purescript 62 | color5 :: P5 -> Number -> Number -> Number -> (Maybe Number) -> Color 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/color) 66 | 67 | #### `green` 68 | 69 | ``` purescript 70 | green :: P5 -> ArrayNumberOrStringOrColor -> Number 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/green) 74 | 75 | #### `hue` 76 | 77 | ``` purescript 78 | hue :: P5 -> ArrayNumberOrStringOrColor -> Number 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/hue) 82 | 83 | #### `lerpColor` 84 | 85 | ``` purescript 86 | lerpColor :: P5 -> Color -> Color -> Number -> Color 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/lerpColor) 90 | 91 | #### `lightness` 92 | 93 | ``` purescript 94 | lightness :: P5 -> ArrayNumberOrStringOrColor -> Number 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/lightness) 98 | 99 | #### `red` 100 | 101 | ``` purescript 102 | red :: P5 -> ArrayNumberOrStringOrColor -> Number 103 | ``` 104 | 105 | [p5js.org documentation](https://p5js.org/reference/#/p5/red) 106 | 107 | #### `saturation` 108 | 109 | ``` purescript 110 | saturation :: P5 -> ArrayNumberOrStringOrColor -> Number 111 | ``` 112 | 113 | [p5js.org documentation](https://p5js.org/reference/#/p5/saturation) 114 | 115 | 116 | -------------------------------------------------------------------------------- /generated-docs/P5/Data/Conversion.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Data.Conversion 2 | 3 | #### `byte` 4 | 5 | ``` purescript 6 | byte :: P5 -> BooleanOrNumberOrString -> Number 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/byte) 10 | 11 | #### `char` 12 | 13 | ``` purescript 14 | char :: P5 -> NumberOrString -> String 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/char) 18 | 19 | #### `float` 20 | 21 | ``` purescript 22 | float :: P5 -> String -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/float) 26 | 27 | #### `hex` 28 | 29 | ``` purescript 30 | hex :: P5 -> Number -> (Maybe Number) -> String 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/hex) 34 | 35 | #### `hex2` 36 | 37 | ``` purescript 38 | hex2 :: P5 -> (Array Number) -> (Maybe Number) -> (Array String) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/hex) 42 | 43 | #### `int2` 44 | 45 | ``` purescript 46 | int2 :: P5 -> BooleanOrNumberOrString -> (Maybe Int) -> Number 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/int) 50 | 51 | #### `str` 52 | 53 | ``` purescript 54 | str :: P5 -> BooleanOrNumberOrString -> String 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/str) 58 | 59 | #### `unchar` 60 | 61 | ``` purescript 62 | unchar :: P5 -> String -> Number 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/unchar) 66 | 67 | #### `unchar2` 68 | 69 | ``` purescript 70 | unchar2 :: P5 -> (Array String) -> (Array Number) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/unchar) 74 | 75 | #### `unhex` 76 | 77 | ``` purescript 78 | unhex :: P5 -> String -> Number 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/unhex) 82 | 83 | #### `unhex2` 84 | 85 | ``` purescript 86 | unhex2 :: P5 -> (Array String) -> (Array Number) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/unhex) 90 | 91 | 92 | -------------------------------------------------------------------------------- /generated-docs/P5/Data/Dictionary.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Data.Dictionary 2 | 3 | #### `createStringDict2` 4 | 5 | ``` purescript 6 | createStringDict2 :: P5 -> String -> String -> StringDict 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/createStringDict) 10 | 11 | 12 | -------------------------------------------------------------------------------- /generated-docs/P5/Data/StringFunctions.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Data.StringFunctions 2 | 3 | #### `match` 4 | 5 | ``` purescript 6 | match :: P5 -> String -> String -> (Array String) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/match) 10 | 11 | #### `matchAll` 12 | 13 | ``` purescript 14 | matchAll :: P5 -> String -> String -> (Array String) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/matchAll) 18 | 19 | #### `nf` 20 | 21 | ``` purescript 22 | nf :: P5 -> NumberOrString -> (Maybe IntOrString) -> (Maybe IntOrString) -> String 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/nf) 26 | 27 | #### `nfc` 28 | 29 | ``` purescript 30 | nfc :: P5 -> NumberOrString -> (Maybe IntOrString) -> String 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfc) 34 | 35 | #### `nfc2` 36 | 37 | ``` purescript 38 | nfc2 :: P5 -> (Array Number) -> (Maybe IntOrString) -> (Array String) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfc) 42 | 43 | #### `nfp` 44 | 45 | ``` purescript 46 | nfp :: P5 -> Number -> (Maybe Int) -> (Maybe Int) -> String 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfp) 50 | 51 | #### `nfp2` 52 | 53 | ``` purescript 54 | nfp2 :: P5 -> (Array Number) -> (Maybe Int) -> (Maybe Int) -> (Array String) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfp) 58 | 59 | #### `nfs` 60 | 61 | ``` purescript 62 | nfs :: P5 -> Number -> (Maybe Int) -> (Maybe Int) -> String 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfs) 66 | 67 | #### `nfs2` 68 | 69 | ``` purescript 70 | nfs2 :: P5 -> (Array Int) -> (Maybe Int) -> (Maybe Int) -> (Array String) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/nfs) 74 | 75 | #### `split` 76 | 77 | ``` purescript 78 | split :: P5 -> String -> String -> (Array String) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/split) 82 | 83 | #### `splitTokens` 84 | 85 | ``` purescript 86 | splitTokens :: P5 -> String -> (Maybe String) -> (Array String) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/splitTokens) 90 | 91 | #### `trim` 92 | 93 | ``` purescript 94 | trim :: P5 -> String -> String 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/trim) 98 | 99 | 100 | -------------------------------------------------------------------------------- /generated-docs/P5/Environment.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Environment 2 | 3 | #### `cursor` 4 | 5 | ``` purescript 6 | cursor :: P5 -> CursorTypeOrString -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/cursor) 10 | 11 | #### `displayDensity` 12 | 13 | ``` purescript 14 | displayDensity :: P5 -> Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/displayDensity) 18 | 19 | #### `frameCount` 20 | 21 | ``` purescript 22 | frameCount :: P5 -> Effect Int 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/frameCount) 26 | 27 | #### `frameRate` 28 | 29 | ``` purescript 30 | frameRate :: P5 -> Number 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/frameRate) 34 | 35 | #### `frameRate2` 36 | 37 | ``` purescript 38 | frameRate2 :: P5 -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/frameRate) 42 | 43 | #### `fullscreen` 44 | 45 | ``` purescript 46 | fullscreen :: P5 -> (Maybe Boolean) -> Boolean 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/fullscreen) 50 | 51 | #### `getURL` 52 | 53 | ``` purescript 54 | getURL :: P5 -> String 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/getURL) 58 | 59 | #### `getURLPath` 60 | 61 | ``` purescript 62 | getURLPath :: P5 -> (Array String) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/getURLPath) 66 | 67 | #### `height` 68 | 69 | ``` purescript 70 | height :: P5 -> Number 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/height) 74 | 75 | #### `noCursor` 76 | 77 | ``` purescript 78 | noCursor :: P5 -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/noCursor) 82 | 83 | #### `pixelDensity` 84 | 85 | ``` purescript 86 | pixelDensity :: P5 -> Number 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/pixelDensity) 90 | 91 | #### `pixelDensity2` 92 | 93 | ``` purescript 94 | pixelDensity2 :: P5 -> Number -> (Effect Unit) 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/pixelDensity) 98 | 99 | #### `width` 100 | 101 | ``` purescript 102 | width :: P5 -> Number 103 | ``` 104 | 105 | [p5js.org documentation](https://p5js.org/reference/#/p5/width) 106 | 107 | #### `windowResized` 108 | 109 | ``` purescript 110 | windowResized :: P5 -> (Effect Unit) 111 | ``` 112 | 113 | [p5js.org documentation](https://p5js.org/reference/#/p5/windowResized) 114 | 115 | 116 | -------------------------------------------------------------------------------- /generated-docs/P5/Environment/Environment.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Environment.Environment 2 | 3 | #### `cursor` 4 | 5 | ``` purescript 6 | cursor :: P5 -> CursorTypeOrString -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/cursor) 10 | 11 | #### `displayDensity` 12 | 13 | ``` purescript 14 | displayDensity :: P5 -> Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/displayDensity) 18 | 19 | #### `frameRate` 20 | 21 | ``` purescript 22 | frameRate :: P5 -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/frameRate) 26 | 27 | #### `frameRate2` 28 | 29 | ``` purescript 30 | frameRate2 :: P5 -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/frameRate) 34 | 35 | #### `fullscreen` 36 | 37 | ``` purescript 38 | fullscreen :: P5 -> (Maybe Boolean) -> Boolean 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/fullscreen) 42 | 43 | #### `getURL` 44 | 45 | ``` purescript 46 | getURL :: P5 -> String 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/getURL) 50 | 51 | #### `getURLPath` 52 | 53 | ``` purescript 54 | getURLPath :: P5 -> (Array String) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/getURLPath) 58 | 59 | #### `noCursor` 60 | 61 | ``` purescript 62 | noCursor :: P5 -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/noCursor) 66 | 67 | #### `pixelDensity` 68 | 69 | ``` purescript 70 | pixelDensity :: P5 -> Number 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/pixelDensity) 74 | 75 | #### `pixelDensity2` 76 | 77 | ``` purescript 78 | pixelDensity2 :: P5 -> Number -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/pixelDensity) 82 | 83 | #### `windowResized` 84 | 85 | ``` purescript 86 | windowResized :: P5 -> (Effect Unit) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/windowResized) 90 | 91 | 92 | -------------------------------------------------------------------------------- /generated-docs/P5/Events/Acceleration.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Events.Acceleration 2 | 3 | #### `deviceMoved` 4 | 5 | ``` purescript 6 | deviceMoved :: P5 -> (Effect Unit) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceMoved) 10 | 11 | #### `deviceShaken` 12 | 13 | ``` purescript 14 | deviceShaken :: P5 -> (Effect Unit) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceShaken) 18 | 19 | #### `deviceTurned` 20 | 21 | ``` purescript 22 | deviceTurned :: P5 -> (Effect Unit) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceTurned) 26 | 27 | #### `setMoveThreshold` 28 | 29 | ``` purescript 30 | setMoveThreshold :: P5 -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/setMoveThreshold) 34 | 35 | #### `setShakeThreshold` 36 | 37 | ``` purescript 38 | setShakeThreshold :: P5 -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/setShakeThreshold) 42 | 43 | 44 | -------------------------------------------------------------------------------- /generated-docs/P5/Events/Keyboard.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Events.Keyboard 2 | 3 | #### `keyIsDown` 4 | 5 | ``` purescript 6 | keyIsDown :: P5 -> Number -> Boolean 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/keyIsDown) 10 | 11 | #### `keyPressed` 12 | 13 | ``` purescript 14 | keyPressed :: P5 -> (Effect Boolean) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/keyPressed) 18 | 19 | #### `keyReleased` 20 | 21 | ``` purescript 22 | keyReleased :: P5 -> (Effect Boolean) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/keyReleased) 26 | 27 | #### `keyTyped` 28 | 29 | ``` purescript 30 | keyTyped :: P5 -> (Effect Boolean) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/keyTyped) 34 | 35 | 36 | -------------------------------------------------------------------------------- /generated-docs/P5/Events/Mouse.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Events.Mouse 2 | 3 | #### `doubleClicked` 4 | 5 | ``` purescript 6 | doubleClicked :: P5 -> (Effect Boolean) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/doubleClicked) 10 | 11 | #### `mouseClicked` 12 | 13 | ``` purescript 14 | mouseClicked :: P5 -> (Effect Boolean) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseClicked) 18 | 19 | #### `mouseDragged` 20 | 21 | ``` purescript 22 | mouseDragged :: P5 -> (Effect Boolean) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseDragged) 26 | 27 | #### `mouseMoved` 28 | 29 | ``` purescript 30 | mouseMoved :: P5 -> (Effect Boolean) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseMoved) 34 | 35 | #### `mousePressed` 36 | 37 | ``` purescript 38 | mousePressed :: P5 -> (Effect Boolean) -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/mousePressed) 42 | 43 | #### `mouseReleased` 44 | 45 | ``` purescript 46 | mouseReleased :: P5 -> (Effect Boolean) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseReleased) 50 | 51 | #### `mouseWheel` 52 | 53 | ``` purescript 54 | mouseWheel :: P5 -> (Effect Boolean) -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseWheel) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Events/Touch.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Events.Touch 2 | 3 | #### `touchEnded` 4 | 5 | ``` purescript 6 | touchEnded :: P5 -> (Effect Boolean) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/touchEnded) 10 | 11 | #### `touchMoved` 12 | 13 | ``` purescript 14 | touchMoved :: P5 -> (Effect Boolean) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/touchMoved) 18 | 19 | #### `touchStarted` 20 | 21 | ``` purescript 22 | touchStarted :: P5 -> (Effect Boolean) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/touchStarted) 26 | 27 | 28 | -------------------------------------------------------------------------------- /generated-docs/P5/IO.md: -------------------------------------------------------------------------------- 1 | ## Module P5.IO 2 | 3 | 4 | ### Re-exported from P5.IO.Input: 5 | 6 | #### `loadStrings` 7 | 8 | ``` purescript 9 | loadStrings :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> (Array String) 10 | ``` 11 | 12 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadStrings) 13 | 14 | ### Re-exported from P5.IO.Output: 15 | 16 | #### `saveTable` 17 | 18 | ``` purescript 19 | saveTable :: P5 -> Table -> String -> (Maybe String) -> (Effect Unit) 20 | ``` 21 | 22 | [p5js.org documentation](https://p5js.org/reference/#/p5/saveTable) 23 | 24 | #### `saveStrings` 25 | 26 | ``` purescript 27 | saveStrings :: P5 -> (Array String) -> String -> (Maybe String) -> (Effect Unit) 28 | ``` 29 | 30 | [p5js.org documentation](https://p5js.org/reference/#/p5/saveStrings) 31 | 32 | #### `createWriter` 33 | 34 | ``` purescript 35 | createWriter :: P5 -> String -> (Maybe String) -> PrintWriter 36 | ``` 37 | 38 | [p5js.org documentation](https://p5js.org/reference/#/p5/createWriter) 39 | 40 | ### Re-exported from P5.IO.TimeAndDate: 41 | 42 | #### `year` 43 | 44 | ``` purescript 45 | year :: P5 -> Int 46 | ``` 47 | 48 | [p5js.org documentation](https://p5js.org/reference/#/p5/year) 49 | 50 | #### `second` 51 | 52 | ``` purescript 53 | second :: P5 -> Int 54 | ``` 55 | 56 | [p5js.org documentation](https://p5js.org/reference/#/p5/second) 57 | 58 | #### `month` 59 | 60 | ``` purescript 61 | month :: P5 -> Int 62 | ``` 63 | 64 | [p5js.org documentation](https://p5js.org/reference/#/p5/month) 65 | 66 | #### `minute` 67 | 68 | ``` purescript 69 | minute :: P5 -> Int 70 | ``` 71 | 72 | [p5js.org documentation](https://p5js.org/reference/#/p5/minute) 73 | 74 | #### `millis` 75 | 76 | ``` purescript 77 | millis :: P5 -> Number 78 | ``` 79 | 80 | [p5js.org documentation](https://p5js.org/reference/#/p5/millis) 81 | 82 | #### `hour` 83 | 84 | ``` purescript 85 | hour :: P5 -> Int 86 | ``` 87 | 88 | [p5js.org documentation](https://p5js.org/reference/#/p5/hour) 89 | 90 | #### `day` 91 | 92 | ``` purescript 93 | day :: P5 -> Int 94 | ``` 95 | 96 | [p5js.org documentation](https://p5js.org/reference/#/p5/day) 97 | 98 | -------------------------------------------------------------------------------- /generated-docs/P5/IO/Input.md: -------------------------------------------------------------------------------- 1 | ## Module P5.IO.Input 2 | 3 | #### `loadStrings` 4 | 5 | ``` purescript 6 | loadStrings :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> (Array String) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadStrings) 10 | 11 | 12 | -------------------------------------------------------------------------------- /generated-docs/P5/IO/Output.md: -------------------------------------------------------------------------------- 1 | ## Module P5.IO.Output 2 | 3 | #### `createWriter` 4 | 5 | ``` purescript 6 | createWriter :: P5 -> String -> (Maybe String) -> PrintWriter 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/createWriter) 10 | 11 | #### `saveStrings` 12 | 13 | ``` purescript 14 | saveStrings :: P5 -> (Array String) -> String -> (Maybe String) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/saveStrings) 18 | 19 | #### `saveTable` 20 | 21 | ``` purescript 22 | saveTable :: P5 -> Table -> String -> (Maybe String) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/saveTable) 26 | 27 | 28 | -------------------------------------------------------------------------------- /generated-docs/P5/IO/TimeAndDate.md: -------------------------------------------------------------------------------- 1 | ## Module P5.IO.TimeAndDate 2 | 3 | #### `day` 4 | 5 | ``` purescript 6 | day :: P5 -> Int 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/day) 10 | 11 | #### `hour` 12 | 13 | ``` purescript 14 | hour :: P5 -> Int 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/hour) 18 | 19 | #### `millis` 20 | 21 | ``` purescript 22 | millis :: P5 -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/millis) 26 | 27 | #### `minute` 28 | 29 | ``` purescript 30 | minute :: P5 -> Int 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/minute) 34 | 35 | #### `month` 36 | 37 | ``` purescript 38 | month :: P5 -> Int 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/month) 42 | 43 | #### `second` 44 | 45 | ``` purescript 46 | second :: P5 -> Int 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/second) 50 | 51 | #### `year` 52 | 53 | ``` purescript 54 | year :: P5 -> Int 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/year) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Image/Image.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Image.Image 2 | 3 | #### `createImage` 4 | 5 | ``` purescript 6 | createImage :: P5 -> Int -> Int -> Image 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/createImage) 10 | 11 | #### `saveCanvas` 12 | 13 | ``` purescript 14 | saveCanvas :: P5 -> (Maybe String) -> (Maybe String) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/saveCanvas) 18 | 19 | 20 | -------------------------------------------------------------------------------- /generated-docs/P5/Image/LoadingAndDisplaying.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Image.LoadingAndDisplaying 2 | 3 | #### `image` 4 | 5 | ``` purescript 6 | image :: P5 -> ElementOrImage -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/image) 10 | 11 | #### `image2` 12 | 13 | ``` purescript 14 | image2 :: P5 -> ElementOrImage -> Number -> Number -> Number -> Number -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/image) 18 | 19 | #### `imageMode` 20 | 21 | ``` purescript 22 | imageMode :: P5 -> ImageMode -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/imageMode) 26 | 27 | #### `loadImage` 28 | 29 | ``` purescript 30 | loadImage :: P5 -> String -> Maybe (Image -> Effect Unit) -> Maybe (Effect Unit) -> Image 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadImage) 34 | 35 | #### `noTint` 36 | 37 | ``` purescript 38 | noTint :: P5 -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/noTint) 42 | 43 | #### `tint` 44 | 45 | ``` purescript 46 | tint :: P5 -> String -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/tint) 50 | 51 | #### `tint2` 52 | 53 | ``` purescript 54 | tint2 :: P5 -> (Array Number) -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/tint) 58 | 59 | #### `tint3` 60 | 61 | ``` purescript 62 | tint3 :: P5 -> Color -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/tint) 66 | 67 | #### `tint4` 68 | 69 | ``` purescript 70 | tint4 :: P5 -> Number -> (Maybe Number) -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/tint) 74 | 75 | #### `tint5` 76 | 77 | ``` purescript 78 | tint5 :: P5 -> Number -> Number -> Number -> (Maybe Number) -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/tint) 82 | 83 | 84 | -------------------------------------------------------------------------------- /generated-docs/P5/Image/Pixels.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Image.Pixels 2 | 3 | #### `blend` 4 | 5 | ``` purescript 6 | blend :: P5 -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> BlendMode -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/blend) 10 | 11 | #### `copy` 12 | 13 | ``` purescript 14 | copy :: P5 -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/copy) 18 | 19 | #### `copy2` 20 | 21 | ``` purescript 22 | copy2 :: P5 -> ElementOrImage -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/copy) 26 | 27 | #### `filter` 28 | 29 | ``` purescript 30 | filter :: P5 -> FilterType -> (Maybe Number) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/filter) 34 | 35 | #### `get` 36 | 37 | ``` purescript 38 | get :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> ArrayNumberOrImage 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/get) 42 | 43 | #### `loadPixels` 44 | 45 | ``` purescript 46 | loadPixels :: P5 -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadPixels) 50 | 51 | #### `set` 52 | 53 | ``` purescript 54 | set :: P5 -> Number -> Number -> NumberOrArrayNumberOrColorOrImage -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/set) 58 | 59 | #### `updatePixels` 60 | 61 | ``` purescript 62 | updatePixels :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/updatePixels) 66 | 67 | 68 | -------------------------------------------------------------------------------- /generated-docs/P5/LightsAndCamera/Camera.md: -------------------------------------------------------------------------------- 1 | ## Module P5.LightsAndCamera.Camera 2 | 3 | #### `camera` 4 | 5 | ``` purescript 6 | camera :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/camera) 10 | 11 | #### `createCamera` 12 | 13 | ``` purescript 14 | createCamera :: P5 -> Camera 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/createCamera) 18 | 19 | #### `ortho` 20 | 21 | ``` purescript 22 | ortho :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/ortho) 26 | 27 | #### `perspective` 28 | 29 | ``` purescript 30 | perspective :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/perspective) 34 | 35 | #### `setCamera` 36 | 37 | ``` purescript 38 | setCamera :: P5 -> Camera -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/setCamera) 42 | 43 | 44 | -------------------------------------------------------------------------------- /generated-docs/P5/LightsAndCamera/Interaction.md: -------------------------------------------------------------------------------- 1 | ## Module P5.LightsAndCamera.Interaction 2 | 3 | #### `debugMode` 4 | 5 | ``` purescript 6 | debugMode :: P5 -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 10 | 11 | #### `debugMode2` 12 | 13 | ``` purescript 14 | debugMode2 :: P5 -> DebugMode -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 18 | 19 | #### `debugMode3` 20 | 21 | ``` purescript 22 | debugMode3 :: P5 -> DebugMode -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 26 | 27 | #### `debugMode4` 28 | 29 | ``` purescript 30 | debugMode4 :: P5 -> DebugMode -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 34 | 35 | #### `debugMode5` 36 | 37 | ``` purescript 38 | debugMode5 :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 42 | 43 | #### `noDebugMode` 44 | 45 | ``` purescript 46 | noDebugMode :: P5 -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/noDebugMode) 50 | 51 | #### `orbitControl` 52 | 53 | ``` purescript 54 | orbitControl :: P5 -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/orbitControl) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/LightsAndCamera/Lights.md: -------------------------------------------------------------------------------- 1 | ## Module P5.LightsAndCamera.Lights 2 | 3 | #### `ambientLight` 4 | 5 | ``` purescript 6 | ambientLight :: P5 -> String -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientLight) 10 | 11 | #### `ambientLight2` 12 | 13 | ``` purescript 14 | ambientLight2 :: P5 -> (Array Number) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientLight) 18 | 19 | #### `ambientLight3` 20 | 21 | ``` purescript 22 | ambientLight3 :: P5 -> Color -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientLight) 26 | 27 | #### `ambientLight4` 28 | 29 | ``` purescript 30 | ambientLight4 :: P5 -> Number -> (Maybe Number) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientLight) 34 | 35 | #### `ambientLight5` 36 | 37 | ``` purescript 38 | ambientLight5 :: P5 -> Number -> Number -> Number -> (Maybe Number) -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientLight) 42 | 43 | #### `directionalLight` 44 | 45 | ``` purescript 46 | directionalLight :: P5 -> ArrayNumberOrStringOrColor -> Vector -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/directionalLight) 50 | 51 | #### `directionalLight2` 52 | 53 | ``` purescript 54 | directionalLight2 :: P5 -> Number -> Number -> Number -> Vector -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/directionalLight) 58 | 59 | #### `directionalLight3` 60 | 61 | ``` purescript 62 | directionalLight3 :: P5 -> ArrayNumberOrStringOrColor -> Number -> Number -> Number -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/directionalLight) 66 | 67 | #### `directionalLight4` 68 | 69 | ``` purescript 70 | directionalLight4 :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/directionalLight) 74 | 75 | #### `pointLight` 76 | 77 | ``` purescript 78 | pointLight :: P5 -> ArrayNumberOrStringOrColor -> Vector -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/pointLight) 82 | 83 | #### `pointLight2` 84 | 85 | ``` purescript 86 | pointLight2 :: P5 -> Number -> Number -> Number -> Vector -> (Effect Unit) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/pointLight) 90 | 91 | #### `pointLight3` 92 | 93 | ``` purescript 94 | pointLight3 :: P5 -> ArrayNumberOrStringOrColor -> Number -> Number -> Number -> (Effect Unit) 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/pointLight) 98 | 99 | #### `pointLight4` 100 | 101 | ``` purescript 102 | pointLight4 :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 103 | ``` 104 | 105 | [p5js.org documentation](https://p5js.org/reference/#/p5/pointLight) 106 | 107 | 108 | -------------------------------------------------------------------------------- /generated-docs/P5/LightsAndCamera/Material.md: -------------------------------------------------------------------------------- 1 | ## Module P5.LightsAndCamera.Material 2 | 3 | #### `ambientMaterial` 4 | 5 | ``` purescript 6 | ambientMaterial :: P5 -> ArrayNumberOrStringOrColor -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientMaterial) 10 | 11 | #### `ambientMaterial2` 12 | 13 | ``` purescript 14 | ambientMaterial2 :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientMaterial) 18 | 19 | #### `createShader` 20 | 21 | ``` purescript 22 | createShader :: P5 -> String -> String -> Shader 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/createShader) 26 | 27 | #### `loadShader` 28 | 29 | ``` purescript 30 | loadShader :: P5 -> (Maybe String) -> (Maybe String) -> Shader 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadShader) 34 | 35 | #### `normalMaterial` 36 | 37 | ``` purescript 38 | normalMaterial :: P5 -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/normalMaterial) 42 | 43 | #### `shader` 44 | 45 | ``` purescript 46 | shader :: P5 -> (Maybe Shader) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/shader) 50 | 51 | #### `specularMaterial` 52 | 53 | ``` purescript 54 | specularMaterial :: P5 -> ArrayNumberOrStringOrColor -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/specularMaterial) 58 | 59 | #### `specularMaterial2` 60 | 61 | ``` purescript 62 | specularMaterial2 :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/specularMaterial) 66 | 67 | #### `texture` 68 | 69 | ``` purescript 70 | texture :: P5 -> GraphicsOrImageOrMediaElement -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/texture) 74 | 75 | 76 | -------------------------------------------------------------------------------- /generated-docs/P5/Math/Math.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Math.Math 2 | 3 | #### `createVector` 4 | 5 | ``` purescript 6 | createVector :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> Vector 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/createVector) 10 | 11 | 12 | -------------------------------------------------------------------------------- /generated-docs/P5/Math/Noise.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Math.Noise 2 | 3 | #### `noiseDetail` 4 | 5 | ``` purescript 6 | noiseDetail :: P5 -> Number -> Number -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/noiseDetail) 10 | 11 | #### `noiseSeed` 12 | 13 | ``` purescript 14 | noiseSeed :: P5 -> Number -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/noiseSeed) 18 | 19 | #### `noise` 20 | 21 | ``` purescript 22 | noise :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> Effect Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/noise) 26 | 27 | 28 | -------------------------------------------------------------------------------- /generated-docs/P5/Math/Random.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Math.Random 2 | 3 | #### `randomSeed` 4 | 5 | ``` purescript 6 | randomSeed :: P5 -> Number -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/randomSeed) 10 | 11 | #### `randomGaussian` 12 | 13 | ``` purescript 14 | randomGaussian :: P5 -> Number -> Number -> Effect Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/randomGaussian) 18 | 19 | #### `random2` 20 | 21 | ``` purescript 22 | random2 :: P5 -> (Maybe Number) -> (Maybe Number) -> Effect Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/random) 26 | 27 | 28 | -------------------------------------------------------------------------------- /generated-docs/P5/Math/Trigonometry.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Math.Trigonometry 2 | 3 | #### `acos` 4 | 5 | ``` purescript 6 | acos :: P5 -> Number -> Number 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/acos) 10 | 11 | #### `angleMode` 12 | 13 | ``` purescript 14 | angleMode :: P5 -> AngleMode -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/angleMode) 18 | 19 | #### `asin` 20 | 21 | ``` purescript 22 | asin :: P5 -> Number -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/asin) 26 | 27 | #### `atan` 28 | 29 | ``` purescript 30 | atan :: P5 -> Number -> Number 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/atan) 34 | 35 | #### `atan2` 36 | 37 | ``` purescript 38 | atan2 :: P5 -> Number -> Number -> Number 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/atan2) 42 | 43 | #### `cos` 44 | 45 | ``` purescript 46 | cos :: P5 -> Number -> Number 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/cos) 50 | 51 | #### `degrees` 52 | 53 | ``` purescript 54 | degrees :: P5 -> Number -> Number 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/degrees) 58 | 59 | #### `radians` 60 | 61 | ``` purescript 62 | radians :: P5 -> Number -> Number 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/radians) 66 | 67 | #### `sin` 68 | 69 | ``` purescript 70 | sin :: P5 -> Number -> Number 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/sin) 74 | 75 | #### `tan` 76 | 77 | ``` purescript 78 | tan :: P5 -> Number -> Number 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/tan) 82 | 83 | 84 | -------------------------------------------------------------------------------- /generated-docs/P5/Rendering.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Rendering 2 | 3 | #### `blendMode` 4 | 5 | ``` purescript 6 | blendMode :: P5 -> BlendMode -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/blendMode) 10 | 11 | #### `createGraphics` 12 | 13 | ``` purescript 14 | createGraphics :: P5 -> Number -> Number -> (Maybe CreateGraphicsRenderer) -> Graphics 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/createGraphics) 18 | 19 | #### `createCanvas` 20 | 21 | ``` purescript 22 | createCanvas :: P5 -> Number -> Number -> Maybe CreateCanvasRenderer -> Effect Element 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/createCanvas) 26 | 27 | #### `noCanvas` 28 | 29 | ``` purescript 30 | noCanvas :: P5 -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/noCanvas) 34 | 35 | #### `resizeCanvas` 36 | 37 | ``` purescript 38 | resizeCanvas :: P5 -> Number -> Number -> (Maybe Boolean) -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/resizeCanvas) 42 | 43 | #### `setAttributes2` 44 | 45 | ``` purescript 46 | setAttributes2 :: P5 -> String -> Boolean -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/setAttributes) 50 | 51 | 52 | -------------------------------------------------------------------------------- /generated-docs/P5/Rendering/Rendering.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Rendering.Rendering 2 | 3 | #### `blendMode` 4 | 5 | ``` purescript 6 | blendMode :: P5 -> BlendMode -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/blendMode) 10 | 11 | #### `createGraphics` 12 | 13 | ``` purescript 14 | createGraphics :: P5 -> Number -> Number -> (Maybe CreateGraphicsRenderer) -> Graphics 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/createGraphics) 18 | 19 | #### `noCanvas` 20 | 21 | ``` purescript 22 | noCanvas :: P5 -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/noCanvas) 26 | 27 | #### `resizeCanvas` 28 | 29 | ``` purescript 30 | resizeCanvas :: P5 -> Number -> Number -> (Maybe Boolean) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/resizeCanvas) 34 | 35 | #### `setAttributes2` 36 | 37 | ``` purescript 38 | setAttributes2 :: P5 -> String -> Boolean -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/setAttributes) 42 | 43 | 44 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/Attributes.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.Attributes 2 | 3 | #### `ellipseMode` 4 | 5 | ``` purescript 6 | ellipseMode :: P5 -> EllipseMode -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipseMode) 10 | 11 | #### `noSmooth` 12 | 13 | ``` purescript 14 | noSmooth :: P5 -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/noSmooth) 18 | 19 | #### `rectMode` 20 | 21 | ``` purescript 22 | rectMode :: P5 -> RectMode -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/rectMode) 26 | 27 | #### `smooth` 28 | 29 | ``` purescript 30 | smooth :: P5 -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/smooth) 34 | 35 | #### `strokeCap` 36 | 37 | ``` purescript 38 | strokeCap :: P5 -> StrokeCap -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeCap) 42 | 43 | #### `strokeJoin` 44 | 45 | ``` purescript 46 | strokeJoin :: P5 -> StrokeJoin -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeJoin) 50 | 51 | #### `strokeWeight` 52 | 53 | ``` purescript 54 | strokeWeight :: P5 -> Number -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeWeight) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/Curves.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.Curves 2 | 3 | #### `bezier` 4 | 5 | ``` purescript 6 | bezier :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezier) 10 | 11 | #### `bezierDetail` 12 | 13 | ``` purescript 14 | bezierDetail :: P5 -> Number -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezierDetail) 18 | 19 | #### `bezierPoint` 20 | 21 | ``` purescript 22 | bezierPoint :: P5 -> Number -> Number -> Number -> Number -> Number -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezierPoint) 26 | 27 | #### `bezierTangent` 28 | 29 | ``` purescript 30 | bezierTangent :: P5 -> Number -> Number -> Number -> Number -> Number -> Number 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezierTangent) 34 | 35 | #### `curve` 36 | 37 | ``` purescript 38 | curve :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/curve) 42 | 43 | #### `curveDetail` 44 | 45 | ``` purescript 46 | curveDetail :: P5 -> Number -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/curveDetail) 50 | 51 | #### `curvePoint` 52 | 53 | ``` purescript 54 | curvePoint :: P5 -> Number -> Number -> Number -> Number -> Number -> Number 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/curvePoint) 58 | 59 | #### `curveTangent` 60 | 61 | ``` purescript 62 | curveTangent :: P5 -> Number -> Number -> Number -> Number -> Number -> Number 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/curveTangent) 66 | 67 | #### `curveTightness` 68 | 69 | ``` purescript 70 | curveTightness :: P5 -> Number -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/curveTightness) 74 | 75 | 76 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/ThreeDModels.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.ThreeDModels 2 | 3 | #### `model` 4 | 5 | ``` purescript 6 | model :: P5 -> Geometry -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/model) 10 | 11 | 12 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/ThreeDPrimitives.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.ThreeDPrimitives 2 | 3 | #### `box` 4 | 5 | ``` purescript 6 | box :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/box) 10 | 11 | #### `cone` 12 | 13 | ``` purescript 14 | cone :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Maybe Boolean) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/cone) 18 | 19 | #### `cylinder` 20 | 21 | ``` purescript 22 | cylinder :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Maybe Boolean) -> (Maybe Boolean) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/cylinder) 26 | 27 | #### `ellipsoid` 28 | 29 | ``` purescript 30 | ellipsoid :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipsoid) 34 | 35 | #### `plane` 36 | 37 | ``` purescript 38 | plane :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/plane) 42 | 43 | #### `sphere` 44 | 45 | ``` purescript 46 | sphere :: P5 -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/sphere) 50 | 51 | #### `torus` 52 | 53 | ``` purescript 54 | torus :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/torus) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/TwoDPrimitives.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.TwoDPrimitives 2 | 3 | #### `arc` 4 | 5 | ``` purescript 6 | arc :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Maybe ArcMode) -> (Maybe Number) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/arc) 10 | 11 | #### `ellipse` 12 | 13 | ``` purescript 14 | ellipse :: P5 -> Number -> Number -> Number -> (Maybe Number) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipse) 18 | 19 | #### `ellipse2` 20 | 21 | ``` purescript 22 | ellipse2 :: P5 -> Number -> Number -> Number -> Number -> Int -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipse) 26 | 27 | #### `line` 28 | 29 | ``` purescript 30 | line :: P5 -> Number -> Number -> Number -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/line) 34 | 35 | #### `line2` 36 | 37 | ``` purescript 38 | line2 :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/line) 42 | 43 | #### `point` 44 | 45 | ``` purescript 46 | point :: P5 -> Number -> Number -> (Maybe Number) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/point) 50 | 51 | #### `quad` 52 | 53 | ``` purescript 54 | quad :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/quad) 58 | 59 | #### `rect` 60 | 61 | ``` purescript 62 | rect :: P5 -> Number -> Number -> Number -> Number -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/rect) 66 | 67 | #### `rect2` 68 | 69 | ``` purescript 70 | rect2 :: P5 -> Number -> Number -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/rect) 74 | 75 | #### `triangle` 76 | 77 | ``` purescript 78 | triangle :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/triangle) 82 | 83 | 84 | -------------------------------------------------------------------------------- /generated-docs/P5/Shape/Vertex.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Shape.Vertex 2 | 3 | #### `beginContour` 4 | 5 | ``` purescript 6 | beginContour :: P5 -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/beginContour) 10 | 11 | #### `beginShape` 12 | 13 | ``` purescript 14 | beginShape :: P5 -> (Maybe BeginShapeKind) -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/beginShape) 18 | 19 | #### `bezierVertex` 20 | 21 | ``` purescript 22 | bezierVertex :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezierVertex) 26 | 27 | #### `bezierVertex2` 28 | 29 | ``` purescript 30 | bezierVertex2 :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/bezierVertex) 34 | 35 | #### `curveVertex` 36 | 37 | ``` purescript 38 | curveVertex :: P5 -> Number -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/curveVertex) 42 | 43 | #### `curveVertex2` 44 | 45 | ``` purescript 46 | curveVertex2 :: P5 -> Number -> Number -> (Maybe Number) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/curveVertex) 50 | 51 | #### `endContour` 52 | 53 | ``` purescript 54 | endContour :: P5 -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/endContour) 58 | 59 | #### `endShape` 60 | 61 | ``` purescript 62 | endShape :: P5 -> (Maybe EndShapeMode) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/endShape) 66 | 67 | #### `quadraticVertex` 68 | 69 | ``` purescript 70 | quadraticVertex :: P5 -> Number -> Number -> Number -> Number -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/quadraticVertex) 74 | 75 | #### `quadraticVertex2` 76 | 77 | ``` purescript 78 | quadraticVertex2 :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/quadraticVertex) 82 | 83 | #### `vertex` 84 | 85 | ``` purescript 86 | vertex :: P5 -> Number -> Number -> (Effect Unit) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/vertex) 90 | 91 | #### `vertex2` 92 | 93 | ``` purescript 94 | vertex2 :: P5 -> Number -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/vertex) 98 | 99 | 100 | -------------------------------------------------------------------------------- /generated-docs/P5/Structure.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Structure 2 | 3 | #### `loop` 4 | 5 | ``` purescript 6 | loop :: P5 -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/loop) 10 | 11 | #### `noLoop` 12 | 13 | ``` purescript 14 | noLoop :: P5 -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/noLoop) 18 | 19 | #### `pop` 20 | 21 | ``` purescript 22 | pop :: P5 -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/pop) 26 | 27 | #### `preload` 28 | 29 | ``` purescript 30 | preload :: P5 -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/preload) 34 | 35 | #### `push` 36 | 37 | ``` purescript 38 | push :: P5 -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/push) 42 | 43 | #### `redraw` 44 | 45 | ``` purescript 46 | redraw :: P5 -> (Maybe Int) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/redraw) 50 | 51 | #### `remove` 52 | 53 | ``` purescript 54 | remove :: P5 -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/remove) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Structure/Structure.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Structure.Structure 2 | 3 | #### `loop` 4 | 5 | ``` purescript 6 | loop :: P5 -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/loop) 10 | 11 | #### `noLoop` 12 | 13 | ``` purescript 14 | noLoop :: P5 -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/noLoop) 18 | 19 | #### `pop` 20 | 21 | ``` purescript 22 | pop :: P5 -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/pop) 26 | 27 | #### `preload` 28 | 29 | ``` purescript 30 | preload :: P5 -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/preload) 34 | 35 | #### `push` 36 | 37 | ``` purescript 38 | push :: P5 -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/push) 42 | 43 | #### `redraw` 44 | 45 | ``` purescript 46 | redraw :: P5 -> (Maybe Int) -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/redraw) 50 | 51 | #### `remove` 52 | 53 | ``` purescript 54 | remove :: P5 -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/remove) 58 | 59 | 60 | -------------------------------------------------------------------------------- /generated-docs/P5/Transform.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Transform 2 | 3 | #### `applyMatrix` 4 | 5 | ``` purescript 6 | applyMatrix :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/applyMatrix) 10 | 11 | #### `resetMatrix` 12 | 13 | ``` purescript 14 | resetMatrix :: P5 -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/resetMatrix) 18 | 19 | #### `rotate` 20 | 21 | ``` purescript 22 | rotate :: P5 -> Number -> (Maybe ArrayNumberOrVector) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotate) 26 | 27 | #### `rotateX` 28 | 29 | ``` purescript 30 | rotateX :: P5 -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateX) 34 | 35 | #### `rotateY` 36 | 37 | ``` purescript 38 | rotateY :: P5 -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateY) 42 | 43 | #### `rotateZ` 44 | 45 | ``` purescript 46 | rotateZ :: P5 -> Number -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateZ) 50 | 51 | #### `scale` 52 | 53 | ``` purescript 54 | scale :: P5 -> ArrayNumberOrVector -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/scale) 58 | 59 | #### `scale2` 60 | 61 | ``` purescript 62 | scale2 :: P5 -> NumberOrArrayNumberOrVector -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/scale) 66 | 67 | #### `shearX` 68 | 69 | ``` purescript 70 | shearX :: P5 -> Number -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/shearX) 74 | 75 | #### `shearY` 76 | 77 | ``` purescript 78 | shearY :: P5 -> Number -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/shearY) 82 | 83 | #### `translate` 84 | 85 | ``` purescript 86 | translate :: P5 -> Vector -> (Effect Unit) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/translate) 90 | 91 | #### `translate2` 92 | 93 | ``` purescript 94 | translate2 :: P5 -> Number -> Number -> (Maybe Number) -> (Effect Unit) 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/translate) 98 | 99 | 100 | -------------------------------------------------------------------------------- /generated-docs/P5/Transform/Transform.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Transform.Transform 2 | 3 | #### `applyMatrix` 4 | 5 | ``` purescript 6 | applyMatrix :: P5 -> Number -> Number -> Number -> Number -> Number -> Number -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/applyMatrix) 10 | 11 | #### `resetMatrix` 12 | 13 | ``` purescript 14 | resetMatrix :: P5 -> (Effect Unit) 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/resetMatrix) 18 | 19 | #### `rotate` 20 | 21 | ``` purescript 22 | rotate :: P5 -> Number -> (Maybe ArrayNumberOrVector) -> (Effect Unit) 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotate) 26 | 27 | #### `rotateX` 28 | 29 | ``` purescript 30 | rotateX :: P5 -> Number -> (Effect Unit) 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateX) 34 | 35 | #### `rotateY` 36 | 37 | ``` purescript 38 | rotateY :: P5 -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateY) 42 | 43 | #### `rotateZ` 44 | 45 | ``` purescript 46 | rotateZ :: P5 -> Number -> (Effect Unit) 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/rotateZ) 50 | 51 | #### `scale` 52 | 53 | ``` purescript 54 | scale :: P5 -> ArrayNumberOrVector -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/scale) 58 | 59 | #### `scale2` 60 | 61 | ``` purescript 62 | scale2 :: P5 -> NumberOrArrayNumberOrVector -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/scale) 66 | 67 | #### `shearX` 68 | 69 | ``` purescript 70 | shearX :: P5 -> Number -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/shearX) 74 | 75 | #### `shearY` 76 | 77 | ``` purescript 78 | shearY :: P5 -> Number -> (Effect Unit) 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/shearY) 82 | 83 | #### `translate` 84 | 85 | ``` purescript 86 | translate :: P5 -> Vector -> (Effect Unit) 87 | ``` 88 | 89 | [p5js.org documentation](https://p5js.org/reference/#/p5/translate) 90 | 91 | #### `translate2` 92 | 93 | ``` purescript 94 | translate2 :: P5 -> Number -> Number -> (Maybe Number) -> (Effect Unit) 95 | ``` 96 | 97 | [p5js.org documentation](https://p5js.org/reference/#/p5/translate) 98 | 99 | 100 | -------------------------------------------------------------------------------- /generated-docs/P5/Types/Color.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Types.Color 2 | 3 | #### `setRed` 4 | 5 | ``` purescript 6 | setRed :: P5 -> Color -> Number -> Color 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setRed) 10 | 11 | #### `setGreen` 12 | 13 | ``` purescript 14 | setGreen :: P5 -> Color -> Number -> Color 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setGreen) 18 | 19 | #### `setBlue` 20 | 21 | ``` purescript 22 | setBlue :: P5 -> Color -> Number -> Color 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setBlue) 26 | 27 | #### `setAlpha` 28 | 29 | ``` purescript 30 | setAlpha :: P5 -> Color -> Number -> Color 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setAlpha) 34 | 35 | 36 | -------------------------------------------------------------------------------- /generated-docs/P5/Types/Image.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Types.Image 2 | 3 | #### `height` 4 | 5 | ``` purescript 6 | height :: P5 -> Image -> Number 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5.Image/height) 10 | 11 | #### `width` 12 | 13 | ``` purescript 14 | width :: P5 -> Image -> Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5.Image/width) 18 | 19 | 20 | -------------------------------------------------------------------------------- /generated-docs/P5/Typography.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Typography 2 | 3 | 4 | ### Re-exported from P5.Typography.Attributes: 5 | 6 | #### `textWidth` 7 | 8 | ``` purescript 9 | textWidth :: P5 -> String -> Number 10 | ``` 11 | 12 | [p5js.org documentation](https://p5js.org/reference/#/p5/textWidth) 13 | 14 | #### `textStyle2` 15 | 16 | ``` purescript 17 | textStyle2 :: P5 -> TextStyle -> (Effect Unit) 18 | ``` 19 | 20 | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 21 | 22 | #### `textStyle` 23 | 24 | ``` purescript 25 | textStyle :: P5 -> String 26 | ``` 27 | 28 | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 29 | 30 | #### `textSize2` 31 | 32 | ``` purescript 33 | textSize2 :: P5 -> Number -> (Effect Unit) 34 | ``` 35 | 36 | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 37 | 38 | #### `textSize` 39 | 40 | ``` purescript 41 | textSize :: P5 -> Number 42 | ``` 43 | 44 | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 45 | 46 | #### `textLeading2` 47 | 48 | ``` purescript 49 | textLeading2 :: P5 -> Number -> (Effect Unit) 50 | ``` 51 | 52 | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 53 | 54 | #### `textLeading` 55 | 56 | ``` purescript 57 | textLeading :: P5 -> Number 58 | ``` 59 | 60 | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 61 | 62 | #### `textDescent` 63 | 64 | ``` purescript 65 | textDescent :: P5 -> Number 66 | ``` 67 | 68 | [p5js.org documentation](https://p5js.org/reference/#/p5/textDescent) 69 | 70 | #### `textAscent` 71 | 72 | ``` purescript 73 | textAscent :: P5 -> Number 74 | ``` 75 | 76 | [p5js.org documentation](https://p5js.org/reference/#/p5/textAscent) 77 | 78 | #### `textAlign2` 79 | 80 | ``` purescript 81 | textAlign2 :: P5 -> TextAlignHorizAlign -> (Maybe TextAlignVertAlign) -> (Effect Unit) 82 | ``` 83 | 84 | [p5js.org documentation](https://p5js.org/reference/#/p5/textAlign) 85 | 86 | ### Re-exported from P5.Typography.LoadingAndDisplaying: 87 | 88 | #### `loadFont` 89 | 90 | ``` purescript 91 | loadFont :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Font 92 | ``` 93 | 94 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont) 95 | 96 | -------------------------------------------------------------------------------- /generated-docs/P5/Typography/Attributes.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Typography.Attributes 2 | 3 | #### `textAlign2` 4 | 5 | ``` purescript 6 | textAlign2 :: P5 -> TextAlignHorizAlign -> (Maybe TextAlignVertAlign) -> (Effect Unit) 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/textAlign) 10 | 11 | #### `textAscent` 12 | 13 | ``` purescript 14 | textAscent :: P5 -> Number 15 | ``` 16 | 17 | [p5js.org documentation](https://p5js.org/reference/#/p5/textAscent) 18 | 19 | #### `textDescent` 20 | 21 | ``` purescript 22 | textDescent :: P5 -> Number 23 | ``` 24 | 25 | [p5js.org documentation](https://p5js.org/reference/#/p5/textDescent) 26 | 27 | #### `textLeading` 28 | 29 | ``` purescript 30 | textLeading :: P5 -> Number 31 | ``` 32 | 33 | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 34 | 35 | #### `textLeading2` 36 | 37 | ``` purescript 38 | textLeading2 :: P5 -> Number -> (Effect Unit) 39 | ``` 40 | 41 | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 42 | 43 | #### `textSize` 44 | 45 | ``` purescript 46 | textSize :: P5 -> Number 47 | ``` 48 | 49 | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 50 | 51 | #### `textSize2` 52 | 53 | ``` purescript 54 | textSize2 :: P5 -> Number -> (Effect Unit) 55 | ``` 56 | 57 | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 58 | 59 | #### `textStyle` 60 | 61 | ``` purescript 62 | textStyle :: P5 -> String 63 | ``` 64 | 65 | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 66 | 67 | #### `textStyle2` 68 | 69 | ``` purescript 70 | textStyle2 :: P5 -> TextStyle -> (Effect Unit) 71 | ``` 72 | 73 | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 74 | 75 | #### `textWidth` 76 | 77 | ``` purescript 78 | textWidth :: P5 -> String -> Number 79 | ``` 80 | 81 | [p5js.org documentation](https://p5js.org/reference/#/p5/textWidth) 82 | 83 | 84 | -------------------------------------------------------------------------------- /generated-docs/P5/Typography/LoadingAndDisplaying.md: -------------------------------------------------------------------------------- 1 | ## Module P5.Typography.LoadingAndDisplaying 2 | 3 | #### `loadFont` 4 | 5 | ``` purescript 6 | loadFont :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Font 7 | ``` 8 | 9 | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont) 10 | 11 | 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "test": "pulp test --include examples", 5 | "test-watch": "./bin/watch", 6 | "build-watch": "pulp --watch browserify --to dist/Main.js", 7 | "webpack": "DEBUG=purs-loader* DEBUG_DEPTH=100 webpack --progress --bail", 8 | "webpack:server": "webpack-dev-server --progress --inline", 9 | "webpack:dll": "webpack --verbose --colors --display-error-details --progress --config webpack-dll.config.js" 10 | }, 11 | "devDependencies": { 12 | "canvas": "^2.5.0", 13 | "inflection": "^1.12.0", 14 | "jsdom": "^13.0.0", 15 | "jsdom-global": "^3.0.2", 16 | "p5": "^0.7.2", 17 | "purescript": "^0.12.5", 18 | "purescript-psa": "^0.7.3", 19 | "purs-loader": "^3.2.0", 20 | "webpack": "^3.12.0", 21 | "webpack-cli": "^3.1.2", 22 | "webpack-dev-server": "^2.11.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /snapshots/helloP5SimpleShapes: -------------------------------------------------------------------------------- 1 | vjMQHr47Chc/muazSllbCA== 2 | -------------------------------------------------------------------------------- /snapshots/lSystems: -------------------------------------------------------------------------------- 1 | i4kq9QXWGEvyOlb95nO7sA== 2 | -------------------------------------------------------------------------------- /snapshots/lineDrawing: -------------------------------------------------------------------------------- 1 | oDh56UIwjTD7pk/VKGF2og== 2 | -------------------------------------------------------------------------------- /snapshots/structureWidthAndHeight: -------------------------------------------------------------------------------- 1 | zeSdOVpMYbUQoSxvn3go9A== 2 | -------------------------------------------------------------------------------- /src/P5.js: -------------------------------------------------------------------------------- 1 | var p5; 2 | 3 | function trimRightUndefined(array) { 4 | return array.filter(function (x, i) { 5 | return i < array.length - 1 || x !== undefined; 6 | }); 7 | } 8 | 9 | function callP5(p5, method, args) { 10 | return method.apply( 11 | p5, trimRightUndefined(args)); 12 | } 13 | 14 | exports.p5Impl = function(f) { 15 | return function() { 16 | p5 = p5 === undefined ? require('p5') : p5; 17 | return new p5(function(p) { 18 | f(p)(); 19 | }); 20 | } 21 | }; 22 | 23 | exports.getP5Impl = function() { 24 | p5 = p5 === undefined ? require('p5') : p5; 25 | return new p5(function() {}); 26 | }; 27 | 28 | exports.setupImpl = function(p) { 29 | return function(eff) { 30 | return function() { 31 | p.setup = eff; 32 | }; 33 | } 34 | }; 35 | 36 | exports.drawImpl = function(p) { 37 | return function(eff) { 38 | return function() { 39 | p.draw = eff; 40 | }; 41 | }; 42 | }; 43 | 44 | exports.backgroundImpl = function(p) { 45 | return function(str) { 46 | return function() { 47 | p.background(str); 48 | }; 49 | } 50 | }; 51 | 52 | exports.idImpl = function(e) { 53 | return e.id(); 54 | } 55 | 56 | exports.setIdImpl = function(e, x) { 57 | return function() { 58 | e.id(x); 59 | }; 60 | } 61 | 62 | //Object.keys ( 63 | // [].concat ( 64 | // ... 65 | // [].concat ( 66 | // ...json.classitems.filter( 67 | // (i) => i.class === 'p5' && i.itemtype === 'method') 68 | // .map ((i) => (i.params || []).concat( 69 | // i["return"] ? [i["return"]] : [])) 70 | // ).map ((p) => p.type) 71 | // //.map((p) => p.split('|')) 72 | // ) 73 | // .sort() 74 | // .reduce((a, b) => { a[b] = true; return a; }, {})) 75 | // 76 | -------------------------------------------------------------------------------- /src/P5.purs: -------------------------------------------------------------------------------- 1 | module P5 2 | ( p5 3 | , getP5 4 | , setup 5 | , draw 6 | , id 7 | , setId 8 | , module P5.Types 9 | ) where 10 | 11 | import Effect (Effect) 12 | import Effect.Aff (Aff) 13 | import Prelude (Unit) 14 | import Data.Maybe (Maybe) 15 | import Data.Function.Uncurried (Fn2, Fn3, Fn4, runFn2, runFn3, runFn4) 16 | import P5.Types 17 | 18 | foreign import p5Impl :: (P5 -> Effect Unit) -> Effect P5 19 | foreign import getP5Impl :: Effect P5 20 | foreign import setupImpl :: P5 -> Effect Unit -> Effect Unit 21 | foreign import drawImpl :: P5 -> Effect Unit -> Effect Unit 22 | foreign import idImpl :: Element -> String 23 | foreign import setIdImpl :: Fn2 Element String (Effect Unit) 24 | 25 | p5 :: (P5 -> Effect Unit) -> Effect P5 26 | p5 f = p5Impl f 27 | 28 | getP5 :: Effect P5 29 | getP5 = getP5Impl 30 | 31 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/setup) 32 | setup :: P5 -> Effect Unit -> Effect Unit 33 | setup p eff = setupImpl p eff 34 | 35 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/draw) 36 | draw :: P5 -> Effect Unit -> Effect Unit 37 | draw p eff = drawImpl p eff 38 | 39 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/id) 40 | id :: Element -> String 41 | id = idImpl 42 | 43 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/id) 44 | setId :: Element -> String -> Effect Unit 45 | setId = runFn2 setIdImpl 46 | 47 | -------------------------------------------------------------------------------- /src/P5/Color.purs: -------------------------------------------------------------------------------- 1 | module P5.Color 2 | ( module P5.Color.CreatingAndReading 3 | , module P5.Color.Setting 4 | ) where 5 | 6 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 7 | import Effect (Effect) 8 | import Prelude (Unit) 9 | import P5.Types 10 | import Foreign (Foreign, unsafeToForeign) 11 | import Data.Maybe (Maybe, maybe) 12 | import Foreign.NullOrUndefined (undefined) 13 | 14 | import P5.Color.CreatingAndReading 15 | import P5.Color.Setting 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/P5/Color/CreatingAndReading.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.alphaImpl = function(p, color) { 11 | return callP5(p, p.alpha, [color.value0]); 12 | }; 13 | exports.blueImpl = function(p, color) { 14 | return callP5(p, p.blue, [color.value0]); 15 | }; 16 | exports.brightnessImpl = function(p, color) { 17 | return callP5(p, p.brightness, [color.value0]); 18 | }; 19 | exports.colorImpl = function(p, value) { 20 | return callP5(p, p.color, [value]); 21 | }; 22 | exports.color2Impl = function(p, values) { 23 | return callP5(p, p.color, [values]); 24 | }; 25 | exports.color3Impl = function(p, color) { 26 | return callP5(p, p.color, [color]); 27 | }; 28 | exports.color4Impl = function(p, gray, alpha) { 29 | return callP5(p, p.color, [gray, alpha.value0 !== undefined ? alpha.value0 : undefined]); 30 | }; 31 | exports.color5Impl = function(p, v1, v2, v3, alpha) { 32 | return callP5(p, p.color, [v1, v2, v3, alpha.value0 !== undefined ? alpha.value0 : undefined]); 33 | }; 34 | exports.greenImpl = function(p, color) { 35 | return callP5(p, p.green, [color.value0]); 36 | }; 37 | exports.hueImpl = function(p, color) { 38 | return callP5(p, p.hue, [color.value0]); 39 | }; 40 | exports.lerpColorImpl = function(p, c1, c2, amt) { 41 | return callP5(p, p.lerpColor, [c1, c2, amt]); 42 | }; 43 | exports.lightnessImpl = function(p, color) { 44 | return callP5(p, p.lightness, [color.value0]); 45 | }; 46 | exports.redImpl = function(p, color) { 47 | return callP5(p, p.red, [color.value0]); 48 | }; 49 | exports.saturationImpl = function(p, color) { 50 | return callP5(p, p.saturation, [color.value0]); 51 | }; 52 | -------------------------------------------------------------------------------- /src/P5/Data.purs: -------------------------------------------------------------------------------- 1 | module P5.Data 2 | ( module P5.Data.Conversion 3 | , module P5.Data.Dictionary 4 | , module P5.Data.StringFunctions 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | import P5.Data.Conversion 16 | import P5.Data.Dictionary 17 | import P5.Data.StringFunctions 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/P5/Data/Conversion.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.byteImpl = function(p, n) { 11 | return callP5(p, p.byte, [n.value0]); 12 | }; 13 | exports.charImpl = function(p, n) { 14 | return callP5(p, p.char, [n.value0]); 15 | }; 16 | exports.floatImpl = function(p, str) { 17 | return callP5(p, p.float, [str]); 18 | }; 19 | exports.hexImpl = function(p, n, digits) { 20 | return callP5(p, p.hex, [n, digits.value0 !== undefined ? digits.value0 : undefined]); 21 | }; 22 | exports.hex2Impl = function(p, ns, digits) { 23 | return callP5(p, p.hex, [ns, digits.value0 !== undefined ? digits.value0 : undefined]); 24 | }; 25 | exports.int2Impl = function(p, n, radix) { 26 | return callP5(p, p.int, [n.value0, radix.value0 !== undefined ? radix.value0 : undefined]); 27 | }; 28 | exports.strImpl = function(p, n) { 29 | return callP5(p, p.str, [n.value0]); 30 | }; 31 | exports.uncharImpl = function(p, n) { 32 | return callP5(p, p.unchar, [n]); 33 | }; 34 | exports.unchar2Impl = function(p, ns) { 35 | return callP5(p, p.unchar, [ns]); 36 | }; 37 | exports.unhexImpl = function(p, n) { 38 | return callP5(p, p.unhex, [n]); 39 | }; 40 | exports.unhex2Impl = function(p, ns) { 41 | return callP5(p, p.unhex, [ns]); 42 | }; -------------------------------------------------------------------------------- /src/P5/Data/Conversion.purs: -------------------------------------------------------------------------------- 1 | module P5.Data.Conversion 2 | ( byte 3 | , char 4 | , float 5 | , hex 6 | , hex2 7 | , int2 8 | , str 9 | , unchar 10 | , unchar2 11 | , unhex 12 | , unhex2 13 | ) where 14 | 15 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 16 | import Effect (Effect) 17 | import Prelude (Unit) 18 | import P5.Types 19 | import Foreign (Foreign, unsafeToForeign) 20 | import Data.Maybe (Maybe, maybe) 21 | import Foreign.NullOrUndefined (undefined) 22 | 23 | 24 | 25 | foreign import byteImpl :: Fn2 P5 BooleanOrNumberOrString Number 26 | foreign import charImpl :: Fn2 P5 NumberOrString String 27 | foreign import floatImpl :: Fn2 P5 String Number 28 | foreign import hexImpl :: Fn3 P5 Number (Maybe Number) String 29 | foreign import hex2Impl :: Fn3 P5 (Array Number) (Maybe Number) (Array String) 30 | foreign import int2Impl :: Fn3 P5 BooleanOrNumberOrString (Maybe Int) Number 31 | foreign import strImpl :: Fn2 P5 BooleanOrNumberOrString String 32 | foreign import uncharImpl :: Fn2 P5 String Number 33 | foreign import unchar2Impl :: Fn2 P5 (Array String) (Array Number) 34 | foreign import unhexImpl :: Fn2 P5 String Number 35 | foreign import unhex2Impl :: Fn2 P5 (Array String) (Array Number) 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/byte) 38 | byte :: P5 -> BooleanOrNumberOrString -> Number 39 | byte p5 n = runFn2 byteImpl p5 n 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/char) 42 | char :: P5 -> NumberOrString -> String 43 | char p5 n = runFn2 charImpl p5 n 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/float) 46 | float :: P5 -> String -> Number 47 | float p5 str = runFn2 floatImpl p5 str 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/hex) 50 | hex :: P5 -> Number -> (Maybe Number) -> String 51 | hex p5 n digits = runFn3 hexImpl p5 n digits 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/hex) 54 | hex2 :: P5 -> (Array Number) -> (Maybe Number) -> (Array String) 55 | hex2 p5 ns digits = runFn3 hex2Impl p5 ns digits 56 | 57 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/int) 58 | int2 :: P5 -> BooleanOrNumberOrString -> (Maybe Int) -> Number 59 | int2 p5 n radix = runFn3 int2Impl p5 n radix 60 | 61 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/str) 62 | str :: P5 -> BooleanOrNumberOrString -> String 63 | str p5 n = runFn2 strImpl p5 n 64 | 65 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/unchar) 66 | unchar :: P5 -> String -> Number 67 | unchar p5 n = runFn2 uncharImpl p5 n 68 | 69 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/unchar) 70 | unchar2 :: P5 -> (Array String) -> (Array Number) 71 | unchar2 p5 ns = runFn2 unchar2Impl p5 ns 72 | 73 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/unhex) 74 | unhex :: P5 -> String -> Number 75 | unhex p5 n = runFn2 unhexImpl p5 n 76 | 77 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/unhex) 78 | unhex2 :: P5 -> (Array String) -> (Array Number) 79 | unhex2 p5 ns = runFn2 unhex2Impl p5 ns 80 | -------------------------------------------------------------------------------- /src/P5/Data/Dictionary.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.createStringDict2Impl = function(p, key, value) { 11 | return callP5(p, p.createStringDict, [key, value]); 12 | }; -------------------------------------------------------------------------------- /src/P5/Data/Dictionary.purs: -------------------------------------------------------------------------------- 1 | module P5.Data.Dictionary 2 | ( createStringDict2 3 | ) where 4 | 5 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 6 | import Effect (Effect) 7 | import Prelude (Unit) 8 | import P5.Types 9 | import Foreign (Foreign, unsafeToForeign) 10 | import Data.Maybe (Maybe, maybe) 11 | import Foreign.NullOrUndefined (undefined) 12 | 13 | 14 | 15 | foreign import createStringDict2Impl :: Fn3 P5 String String StringDict 16 | 17 | -- TODO: unsupported: createStringDict :: P5 -> Unsupported(Object) -> StringDict 18 | 19 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createStringDict) 20 | createStringDict2 :: P5 -> String -> String -> StringDict 21 | createStringDict2 p5 key value = runFn3 createStringDict2Impl p5 key value 22 | -------------------------------------------------------------------------------- /src/P5/Data/StringFunctions.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.matchImpl = function(p, str, regexp) { 11 | return callP5(p, p.match, [str, regexp]); 12 | }; 13 | exports.matchAllImpl = function(p, str, regexp) { 14 | return callP5(p, p.matchAll, [str, regexp]); 15 | }; 16 | exports.nfImpl = function(p, num, left, right) { 17 | return callP5(p, p.nf, [num.value0, left.value0 !== undefined ? left.value0.value0 : undefined, right.value0 !== undefined ? right.value0.value0 : undefined]); 18 | }; 19 | exports.nfcImpl = function(p, num, right) { 20 | return callP5(p, p.nfc, [num.value0, right.value0 !== undefined ? right.value0.value0 : undefined]); 21 | }; 22 | exports.nfc2Impl = function(p, nums, right) { 23 | return callP5(p, p.nfc, [nums, right.value0 !== undefined ? right.value0.value0 : undefined]); 24 | }; 25 | exports.nfpImpl = function(p, num, left, right) { 26 | return callP5(p, p.nfp, [num, left.value0 !== undefined ? left.value0 : undefined, right.value0 !== undefined ? right.value0 : undefined]); 27 | }; 28 | exports.nfp2Impl = function(p, nums, left, right) { 29 | return callP5(p, p.nfp, [nums, left.value0 !== undefined ? left.value0 : undefined, right.value0 !== undefined ? right.value0 : undefined]); 30 | }; 31 | exports.nfsImpl = function(p, num, left, right) { 32 | return callP5(p, p.nfs, [num, left.value0 !== undefined ? left.value0 : undefined, right.value0 !== undefined ? right.value0 : undefined]); 33 | }; 34 | exports.nfs2Impl = function(p, nums, left, right) { 35 | return callP5(p, p.nfs, [nums, left.value0 !== undefined ? left.value0 : undefined, right.value0 !== undefined ? right.value0 : undefined]); 36 | }; 37 | exports.splitImpl = function(p, value, delim) { 38 | return callP5(p, p.split, [value, delim]); 39 | }; 40 | exports.splitTokensImpl = function(p, value, delim) { 41 | return callP5(p, p.splitTokens, [value, delim.value0 !== undefined ? delim.value0 : undefined]); 42 | }; 43 | exports.trimImpl = function(p, str) { 44 | return callP5(p, p.trim, [str]); 45 | }; -------------------------------------------------------------------------------- /src/P5/Environment.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.cursorImpl = function(p, _type, x, y) { 11 | return function() { 12 | callP5(p, p.cursor, [_type.value0, x.value0 !== undefined ? x.value0 : undefined, y.value0 !== undefined ? y.value0 : undefined]); 13 | }; 14 | }; 15 | exports.displayDensityImpl = function(p) { 16 | return callP5(p, p.displayDensity, []); 17 | }; 18 | 19 | exports.frameCountImpl = function(p) { 20 | return p.frameCount; 21 | }; 22 | 23 | exports.frameRateImpl = function(p) { 24 | return callP5(p, p.frameRate, []); 25 | }; 26 | exports.frameRate2Impl = function(p, fps) { 27 | return function() { 28 | callP5(p, p.frameRate, [fps]); 29 | }; 30 | }; 31 | exports.fullscreenImpl = function(p, val) { 32 | return callP5(p, p.fullscreen, [val.value0 !== undefined ? val.value0 : undefined]); 33 | }; 34 | exports.getURLImpl = function(p) { 35 | return callP5(p, p.getURL, []); 36 | }; 37 | exports.getURLPathImpl = function(p) { 38 | return callP5(p, p.getURLPath, []); 39 | }; 40 | exports.heightImpl = function(p) { 41 | return p.height; 42 | }; 43 | exports.noCursorImpl = function(p) { 44 | return function() { 45 | callP5(p, p.noCursor, []); 46 | }; 47 | }; 48 | exports.pixelDensityImpl = function(p) { 49 | return callP5(p, p.pixelDensity, []); 50 | }; 51 | exports.pixelDensity2Impl = function(p, val) { 52 | return function() { 53 | callP5(p, p.pixelDensity, [val]); 54 | }; 55 | }; 56 | exports.widthImpl = function(p) { 57 | return p.width; 58 | }; 59 | exports.windowResizedImpl = function(p) { 60 | return function() { 61 | callP5(p, p.windowResized, []); 62 | }; 63 | }; 64 | -------------------------------------------------------------------------------- /src/P5/Events.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.deviceMovedImpl = function(p) { 11 | return function() { 12 | callP5(p, p.deviceMoved, []); 13 | }; 14 | }; 15 | exports.deviceShakenImpl = function(p) { 16 | return function() { 17 | callP5(p, p.deviceShaken, []); 18 | }; 19 | }; 20 | exports.deviceTurnedImpl = function(p) { 21 | return function() { 22 | callP5(p, p.deviceTurned, []); 23 | }; 24 | }; 25 | exports.doubleClickedImpl = function(p) { 26 | return function() { 27 | callP5(p, p.doubleClicked, []); 28 | }; 29 | }; 30 | exports.keyIsDownImpl = function(p, code) { 31 | return callP5(p, p.keyIsDown, [code]); 32 | }; 33 | exports.keyPressedImpl = function(p) { 34 | return function() { 35 | callP5(p, p.keyPressed, []); 36 | }; 37 | }; 38 | exports.keyReleasedImpl = function(p) { 39 | return function() { 40 | callP5(p, p.keyReleased, []); 41 | }; 42 | }; 43 | exports.keyTypedImpl = function(p) { 44 | return function() { 45 | callP5(p, p.keyTyped, []); 46 | }; 47 | }; 48 | exports.mouseClickedImpl = function(p) { 49 | return function() { 50 | callP5(p, p.mouseClicked, []); 51 | }; 52 | }; 53 | exports.mouseDraggedImpl = function(p) { 54 | return function() { 55 | callP5(p, p.mouseDragged, []); 56 | }; 57 | }; 58 | exports.mouseMovedImpl = function(p) { 59 | return function() { 60 | callP5(p, p.mouseMoved, []); 61 | }; 62 | }; 63 | exports.mousePressedImpl = function(p) { 64 | return function() { 65 | callP5(p, p.mousePressed, []); 66 | }; 67 | }; 68 | exports.mouseReleasedImpl = function(p) { 69 | return function() { 70 | callP5(p, p.mouseReleased, []); 71 | }; 72 | }; 73 | exports.mouseWheelImpl = function(p) { 74 | return function() { 75 | callP5(p, p.mouseWheel, []); 76 | }; 77 | }; 78 | exports.setMoveThresholdImpl = function(p, value) { 79 | return function() { 80 | callP5(p, p.setMoveThreshold, [value]); 81 | }; 82 | }; 83 | exports.setShakeThresholdImpl = function(p, value) { 84 | return function() { 85 | callP5(p, p.setShakeThreshold, [value]); 86 | }; 87 | }; 88 | exports.touchEndedImpl = function(p) { 89 | return function() { 90 | callP5(p, p.touchEnded, []); 91 | }; 92 | }; 93 | exports.touchMovedImpl = function(p) { 94 | return function() { 95 | callP5(p, p.touchMoved, []); 96 | }; 97 | }; 98 | exports.touchStartedImpl = function(p) { 99 | return function() { 100 | callP5(p, p.touchStarted, []); 101 | }; 102 | }; -------------------------------------------------------------------------------- /src/P5/Events.purs: -------------------------------------------------------------------------------- 1 | module P5.Events 2 | ( module P5.Events.Acceleration 3 | , module P5.Events.Mouse 4 | , module P5.Events.Keyboard 5 | , module P5.Events.Touch 6 | ) where 7 | 8 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 9 | import Effect (Effect) 10 | import Prelude (Unit) 11 | import P5.Types 12 | import Foreign (Foreign, unsafeToForeign) 13 | import Data.Maybe (Maybe, maybe) 14 | import Foreign.NullOrUndefined (undefined) 15 | 16 | import P5.Events.Acceleration 17 | import P5.Events.Mouse 18 | import P5.Events.Keyboard 19 | import P5.Events.Touch 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/P5/Events/Acceleration.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.deviceMovedImpl = function(p, eff) { 11 | return function() { 12 | p.deviceMoved = eff; 13 | }; 14 | }; 15 | exports.deviceShakenImpl = function(p, eff) { 16 | return function() { 17 | p.deviceShaken = eff; 18 | }; 19 | }; 20 | exports.deviceTurnedImpl = function(p, eff) { 21 | return function() { 22 | p.deviceTurned = eff; 23 | }; 24 | }; 25 | exports.setMoveThresholdImpl = function(p, value) { 26 | return function() { 27 | callP5(p, p.setMoveThreshold, [value]); 28 | }; 29 | }; 30 | exports.setShakeThresholdImpl = function(p, value) { 31 | return function() { 32 | callP5(p, p.setShakeThreshold, [value]); 33 | }; 34 | }; 35 | -------------------------------------------------------------------------------- /src/P5/Events/Acceleration.purs: -------------------------------------------------------------------------------- 1 | module P5.Events.Acceleration 2 | ( deviceMoved 3 | , deviceShaken 4 | , deviceTurned 5 | , setMoveThreshold 6 | , setShakeThreshold 7 | ) where 8 | 9 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 10 | import Effect (Effect) 11 | import Prelude (Unit) 12 | import P5.Types 13 | import Foreign (Foreign, unsafeToForeign) 14 | import Data.Maybe (Maybe, maybe) 15 | import Foreign.NullOrUndefined (undefined) 16 | 17 | 18 | 19 | foreign import deviceMovedImpl :: Fn2 P5 (Effect Unit) (Effect Unit) 20 | foreign import deviceShakenImpl :: Fn2 P5 (Effect Unit) (Effect Unit) 21 | foreign import deviceTurnedImpl :: Fn2 P5 (Effect Unit) (Effect Unit) 22 | foreign import setMoveThresholdImpl :: Fn2 P5 Number (Effect Unit) 23 | foreign import setShakeThresholdImpl :: Fn2 P5 Number (Effect Unit) 24 | 25 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceMoved) 26 | deviceMoved :: P5 -> (Effect Unit) -> (Effect Unit) 27 | deviceMoved p5 eff = runFn2 deviceMovedImpl p5 eff 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceShaken) 30 | deviceShaken :: P5 -> (Effect Unit) -> (Effect Unit) 31 | deviceShaken p5 eff = runFn2 deviceShakenImpl p5 eff 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/deviceTurned) 34 | deviceTurned :: P5 -> (Effect Unit) -> (Effect Unit) 35 | deviceTurned p5 eff = runFn2 deviceTurnedImpl p5 eff 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/setMoveThreshold) 38 | setMoveThreshold :: P5 -> Number -> (Effect Unit) 39 | setMoveThreshold p5 value = runFn2 setMoveThresholdImpl p5 value 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/setShakeThreshold) 42 | setShakeThreshold :: P5 -> Number -> (Effect Unit) 43 | setShakeThreshold p5 value = runFn2 setShakeThresholdImpl p5 value 44 | -------------------------------------------------------------------------------- /src/P5/Events/Keyboard.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.keyIsDownImpl = function(p, code) { 11 | return callP5(p, p.keyIsDown, [code]); 12 | }; 13 | exports.keyPressedImpl = function(p, eff) { 14 | return function() { 15 | p.keyPressed = eff; 16 | }; 17 | }; 18 | exports.keyReleasedImpl = function(p, eff) { 19 | return function() { 20 | p.keyReleased = eff; 21 | }; 22 | }; 23 | exports.keyTypedImpl = function(p, eff) { 24 | return function() { 25 | p.keyTyped = eff; 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /src/P5/Events/Keyboard.purs: -------------------------------------------------------------------------------- 1 | module P5.Events.Keyboard 2 | ( keyIsDown 3 | , keyPressed 4 | , keyReleased 5 | , keyTyped 6 | ) where 7 | 8 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 9 | import Effect (Effect) 10 | import Prelude (Unit) 11 | import P5.Types 12 | import Foreign (Foreign, unsafeToForeign) 13 | import Data.Maybe (Maybe, maybe) 14 | import Foreign.NullOrUndefined (undefined) 15 | 16 | 17 | 18 | foreign import keyIsDownImpl :: Fn2 P5 Number Boolean 19 | foreign import keyPressedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 20 | foreign import keyReleasedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 21 | foreign import keyTypedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 22 | 23 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/keyIsDown) 24 | keyIsDown :: P5 -> Number -> Boolean 25 | keyIsDown p5 code = runFn2 keyIsDownImpl p5 code 26 | 27 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/keyPressed) 28 | keyPressed :: P5 -> (Effect Boolean) -> (Effect Unit) 29 | keyPressed p5 eff = runFn2 keyPressedImpl p5 eff 30 | 31 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/keyReleased) 32 | keyReleased :: P5 -> (Effect Boolean) -> (Effect Unit) 33 | keyReleased p5 eff = runFn2 keyReleasedImpl p5 eff 34 | 35 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/keyTyped) 36 | keyTyped :: P5 -> (Effect Boolean) -> (Effect Unit) 37 | keyTyped p5 eff = runFn2 keyTypedImpl p5 eff 38 | -------------------------------------------------------------------------------- /src/P5/Events/Mouse.js: -------------------------------------------------------------------------------- 1 | exports.doubleClickedImpl = function(p, eff) { 2 | return function() { 3 | p.doubleClicked = eff; 4 | }; 5 | }; 6 | exports.mouseClickedImpl = function(p, eff) { 7 | return function() { 8 | p.mouseClicked = eff; 9 | }; 10 | }; 11 | exports.mouseDraggedImpl = function(p, eff) { 12 | return function() { 13 | p.mouseDragged = eff; 14 | }; 15 | }; 16 | exports.mouseMovedImpl = function(p, eff) { 17 | return function() { 18 | p.mouseMoved = eff; 19 | }; 20 | }; 21 | exports.mousePressedImpl = function(p, eff) { 22 | return function() { 23 | p.mousePressed = eff; 24 | }; 25 | }; 26 | exports.mouseReleasedImpl = function(p, eff) { 27 | return function() { 28 | p.mouseReleased = eff; 29 | }; 30 | }; 31 | exports.mouseWheelImpl = function(p, eff) { 32 | return function() { 33 | p.mouseWheel = eff; 34 | }; 35 | }; 36 | -------------------------------------------------------------------------------- /src/P5/Events/Mouse.purs: -------------------------------------------------------------------------------- 1 | module P5.Events.Mouse 2 | ( doubleClicked 3 | , mouseClicked 4 | , mouseDragged 5 | , mouseMoved 6 | , mousePressed 7 | , mouseReleased 8 | , mouseWheel 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import doubleClickedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 22 | foreign import mouseClickedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 23 | foreign import mouseDraggedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 24 | foreign import mouseMovedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 25 | foreign import mousePressedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 26 | foreign import mouseReleasedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 27 | foreign import mouseWheelImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/doubleClicked) 30 | doubleClicked :: P5 -> (Effect Boolean) -> (Effect Unit) 31 | doubleClicked p5 eff = runFn2 doubleClickedImpl p5 eff 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseClicked) 34 | mouseClicked :: P5 -> (Effect Boolean) -> (Effect Unit) 35 | mouseClicked p5 eff = runFn2 mouseClickedImpl p5 eff 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseDragged) 38 | mouseDragged :: P5 -> (Effect Boolean) -> (Effect Unit) 39 | mouseDragged p5 eff = runFn2 mouseDraggedImpl p5 eff 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseMoved) 42 | mouseMoved :: P5 -> (Effect Boolean) -> (Effect Unit) 43 | mouseMoved p5 eff = runFn2 mouseMovedImpl p5 eff 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mousePressed) 46 | mousePressed :: P5 -> (Effect Boolean) -> (Effect Unit) 47 | mousePressed p5 eff = runFn2 mousePressedImpl p5 eff 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseReleased) 50 | mouseReleased :: P5 -> (Effect Boolean) -> (Effect Unit) 51 | mouseReleased p5 eff = runFn2 mouseReleasedImpl p5 eff 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/mouseWheel) 54 | mouseWheel :: P5 -> (Effect Boolean) -> (Effect Unit) 55 | mouseWheel p5 eff = runFn2 mouseWheelImpl p5 eff 56 | 57 | -------------------------------------------------------------------------------- /src/P5/Events/Touch.js: -------------------------------------------------------------------------------- 1 | exports.touchEndedImpl = function(p, eff) { 2 | return function() { 3 | p.touchEnded = eff; 4 | }; 5 | }; 6 | exports.touchMovedImpl = function(p, eff) { 7 | return function() { 8 | p.touchMoved = eff; 9 | }; 10 | }; 11 | exports.touchStartedImpl = function(p, eff) { 12 | return function() { 13 | p.touchStarted = eff; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /src/P5/Events/Touch.purs: -------------------------------------------------------------------------------- 1 | module P5.Events.Touch 2 | ( touchEnded 3 | , touchMoved 4 | , touchStarted 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | 16 | 17 | foreign import touchEndedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 18 | foreign import touchMovedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 19 | foreign import touchStartedImpl :: Fn2 P5 (Effect Boolean) (Effect Unit) 20 | 21 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/touchEnded) 22 | touchEnded :: P5 -> (Effect Boolean) -> (Effect Unit) 23 | touchEnded p5 eff = runFn2 touchEndedImpl p5 eff 24 | 25 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/touchMoved) 26 | touchMoved :: P5 -> (Effect Boolean) -> (Effect Unit) 27 | touchMoved p5 eff = runFn2 touchMovedImpl p5 eff 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/touchStarted) 30 | touchStarted :: P5 -> (Effect Boolean) -> (Effect Unit) 31 | touchStarted p5 eff = runFn2 touchStartedImpl p5 eff 32 | -------------------------------------------------------------------------------- /src/P5/IO.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.createWriterImpl = function(p, name, extension) { 11 | return callP5(p, p.createWriter, [name, extension.value0 !== undefined ? extension.value0 : undefined]); 12 | }; 13 | exports.dayImpl = function(p) { 14 | return callP5(p, p.day, []); 15 | }; 16 | exports.hourImpl = function(p) { 17 | return callP5(p, p.hour, []); 18 | }; 19 | exports.loadStringsImpl = function(p, filename, callback, errorCallback) { 20 | return callP5(p, p.loadStrings, [filename, callback.value0 !== undefined ? callback.value0 : undefined, errorCallback.value0 !== undefined ? errorCallback.value0 : undefined]); 21 | }; 22 | exports.millisImpl = function(p) { 23 | return callP5(p, p.millis, []); 24 | }; 25 | exports.minuteImpl = function(p) { 26 | return callP5(p, p.minute, []); 27 | }; 28 | exports.monthImpl = function(p) { 29 | return callP5(p, p.month, []); 30 | }; 31 | exports.saveStringsImpl = function(p, list, filename, extension) { 32 | return function() { 33 | callP5(p, p.saveStrings, [list, filename, extension.value0 !== undefined ? extension.value0 : undefined]); 34 | }; 35 | }; 36 | exports.saveTableImpl = function(p, table, filename, options) { 37 | return function() { 38 | callP5(p, p.saveTable, [table, filename, options.value0 !== undefined ? options.value0 : undefined]); 39 | }; 40 | }; 41 | exports.secondImpl = function(p) { 42 | return callP5(p, p.second, []); 43 | }; 44 | exports.yearImpl = function(p) { 45 | return callP5(p, p.year, []); 46 | }; -------------------------------------------------------------------------------- /src/P5/IO.purs: -------------------------------------------------------------------------------- 1 | module P5.IO 2 | ( module P5.IO.Output 3 | , module P5.IO.TimeAndDate 4 | , module P5.IO.Input 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | import P5.IO.Output 16 | import P5.IO.TimeAndDate 17 | import P5.IO.Input 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/P5/IO/Input.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.loadStringsImpl = function(p, filename, callback, errorCallback) { 11 | return callP5(p, p.loadStrings, [filename, callback.value0 !== undefined ? callback.value0 : undefined, errorCallback.value0 !== undefined ? errorCallback.value0 : undefined]); 12 | }; -------------------------------------------------------------------------------- /src/P5/IO/Input.purs: -------------------------------------------------------------------------------- 1 | module P5.IO.Input 2 | ( loadStrings 3 | ) where 4 | 5 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 6 | import Effect (Effect) 7 | import Prelude (Unit) 8 | import P5.Types 9 | import Foreign (Foreign, unsafeToForeign) 10 | import Data.Maybe (Maybe, maybe) 11 | import Foreign.NullOrUndefined (undefined) 12 | 13 | 14 | 15 | foreign import loadStringsImpl :: Fn4 P5 String (Maybe (Effect Unit)) (Maybe (Effect Unit)) (Array String) 16 | 17 | -- TODO: unsupported: httpDo :: P5 -> String -> Unsupported(Object) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 18 | 19 | -- TODO: unsupported: httpDo2 :: P5 -> String -> (Maybe String) -> (Maybe String) -> Unsupported(Object) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 20 | 21 | -- TODO: unsupported: httpGet :: P5 -> String -> (Effect Unit) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 22 | 23 | -- TODO: unsupported: httpGet2 :: P5 -> String -> UnsupportedProduct(Boolean|Unsupported(Object)) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 24 | 25 | -- TODO: unsupported: httpGet3 :: P5 -> String -> (Maybe String) -> UnsupportedProduct(Boolean|Unsupported(Object)) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 26 | 27 | -- TODO: unsupported: httpPost :: P5 -> String -> (Effect Unit) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 28 | 29 | -- TODO: unsupported: httpPost2 :: P5 -> String -> UnsupportedProduct(Boolean|Unsupported(Object)) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 30 | 31 | -- TODO: unsupported: httpPost3 :: P5 -> String -> (Maybe String) -> UnsupportedProduct(Boolean|Unsupported(Object)) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Promise) 32 | 33 | -- TODO: unsupported: loadBytes :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Object) 34 | 35 | -- TODO: unsupported: loadJSON :: P5 -> String -> (Effect Unit) -> (Maybe (Effect Unit)) -> UnsupportedProduct(Unsupported(Array)|Unsupported(Object)) 36 | 37 | -- TODO: unsupported: loadJSON2 :: P5 -> String -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> UnsupportedProduct(Unsupported(Array)|Unsupported(Object)) 38 | 39 | -- TODO: unsupported: loadJSON3 :: P5 -> String -> Unsupported(Object) -> (Maybe String) -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> UnsupportedProduct(Unsupported(Array)|Unsupported(Object)) 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadStrings) 42 | loadStrings :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> (Array String) 43 | loadStrings p5 filename callback errorCallback = runFn4 loadStringsImpl p5 filename callback errorCallback 44 | 45 | -- TODO: unsupported: loadTable :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Object) 46 | 47 | -- TODO: unsupported: loadTable2 :: P5 -> String -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Object) 48 | 49 | -- TODO: unsupported: loadXML :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Unsupported(Object) 50 | -------------------------------------------------------------------------------- /src/P5/IO/Output.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.createWriterImpl = function(p, name, extension) { 11 | return callP5(p, p.createWriter, [name, extension.value0 !== undefined ? extension.value0 : undefined]); 12 | }; 13 | exports.saveStringsImpl = function(p, list, filename, extension) { 14 | return function() { 15 | callP5(p, p.saveStrings, [list, filename, extension.value0 !== undefined ? extension.value0 : undefined]); 16 | }; 17 | }; 18 | exports.saveTableImpl = function(p, table, filename, options) { 19 | return function() { 20 | callP5(p, p.saveTable, [table, filename, options.value0 !== undefined ? options.value0 : undefined]); 21 | }; 22 | }; -------------------------------------------------------------------------------- /src/P5/IO/Output.purs: -------------------------------------------------------------------------------- 1 | module P5.IO.Output 2 | ( createWriter 3 | , saveStrings 4 | , saveTable 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | 16 | 17 | foreign import createWriterImpl :: Fn3 P5 String (Maybe String) PrintWriter 18 | foreign import saveStringsImpl :: Fn4 P5 (Array String) String (Maybe String) (Effect Unit) 19 | foreign import saveTableImpl :: Fn4 P5 Table String (Maybe String) (Effect Unit) 20 | 21 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createWriter) 22 | createWriter :: P5 -> String -> (Maybe String) -> PrintWriter 23 | createWriter p5 name extension = runFn3 createWriterImpl p5 name extension 24 | 25 | -- TODO: unsupported: downloadFile :: P5 -> UnsupportedProduct(Unsupported(Blob)|String) -> (Maybe String) -> (Maybe String) -> (Effect Unit) 26 | 27 | -- TODO: unsupported: save :: P5 -> UnsupportedProduct(Unsupported(Object)|String) -> (Maybe String) -> (Maybe BooleanOrString) -> (Effect Unit) 28 | 29 | -- TODO: unsupported: saveJSON :: P5 -> UnsupportedProduct(Unsupported(Array)|Unsupported(Object)) -> String -> (Maybe Boolean) -> (Effect Unit) 30 | 31 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/saveStrings) 32 | saveStrings :: P5 -> (Array String) -> String -> (Maybe String) -> (Effect Unit) 33 | saveStrings p5 list filename extension = runFn4 saveStringsImpl p5 list filename extension 34 | 35 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/saveTable) 36 | saveTable :: P5 -> Table -> String -> (Maybe String) -> (Effect Unit) 37 | saveTable p5 table filename options = runFn4 saveTableImpl p5 table filename options 38 | -------------------------------------------------------------------------------- /src/P5/IO/TimeAndDate.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.dayImpl = function(p) { 11 | return callP5(p, p.day, []); 12 | }; 13 | exports.hourImpl = function(p) { 14 | return callP5(p, p.hour, []); 15 | }; 16 | exports.millisImpl = function(p) { 17 | return callP5(p, p.millis, []); 18 | }; 19 | exports.minuteImpl = function(p) { 20 | return callP5(p, p.minute, []); 21 | }; 22 | exports.monthImpl = function(p) { 23 | return callP5(p, p.month, []); 24 | }; 25 | exports.secondImpl = function(p) { 26 | return callP5(p, p.second, []); 27 | }; 28 | exports.yearImpl = function(p) { 29 | return callP5(p, p.year, []); 30 | }; -------------------------------------------------------------------------------- /src/P5/IO/TimeAndDate.purs: -------------------------------------------------------------------------------- 1 | module P5.IO.TimeAndDate 2 | ( day 3 | , hour 4 | , millis 5 | , minute 6 | , month 7 | , second 8 | , year 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import dayImpl :: Fn1 P5 Int 22 | foreign import hourImpl :: Fn1 P5 Int 23 | foreign import millisImpl :: Fn1 P5 Number 24 | foreign import minuteImpl :: Fn1 P5 Int 25 | foreign import monthImpl :: Fn1 P5 Int 26 | foreign import secondImpl :: Fn1 P5 Int 27 | foreign import yearImpl :: Fn1 P5 Int 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/day) 30 | day :: P5 -> Int 31 | day p5 = runFn1 dayImpl p5 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/hour) 34 | hour :: P5 -> Int 35 | hour p5 = runFn1 hourImpl p5 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/millis) 38 | millis :: P5 -> Number 39 | millis p5 = runFn1 millisImpl p5 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/minute) 42 | minute :: P5 -> Int 43 | minute p5 = runFn1 minuteImpl p5 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/month) 46 | month :: P5 -> Int 47 | month p5 = runFn1 monthImpl p5 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/second) 50 | second :: P5 -> Int 51 | second p5 = runFn1 secondImpl p5 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/year) 54 | year :: P5 -> Int 55 | year p5 = runFn1 yearImpl p5 56 | -------------------------------------------------------------------------------- /src/P5/Image.purs: -------------------------------------------------------------------------------- 1 | module P5.Image 2 | ( createImage 3 | , saveCanvas 4 | , module P5.Image.Pixels 5 | , module P5.Image.LoadingAndDisplaying 6 | ) where 7 | 8 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 9 | import Effect (Effect) 10 | import Prelude (Unit) 11 | import P5.Types 12 | import Foreign (Foreign, unsafeToForeign) 13 | import Data.Maybe (Maybe, maybe) 14 | import Foreign.NullOrUndefined (undefined) 15 | 16 | import P5.Image.Pixels 17 | import P5.Image.LoadingAndDisplaying 18 | 19 | foreign import createImageImpl :: Fn3 P5 Int Int Image 20 | foreign import saveCanvasImpl :: Fn3 P5 (Maybe String) (Maybe String) (Effect Unit) 21 | 22 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createImage) 23 | createImage :: P5 -> Int -> Int -> Image 24 | createImage p5 width height = runFn3 createImageImpl p5 width height 25 | 26 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/saveCanvas) 27 | saveCanvas :: P5 -> (Maybe String) -> (Maybe String) -> (Effect Unit) 28 | saveCanvas p5 filename extension = runFn3 saveCanvasImpl p5 filename extension 29 | 30 | -- TODO: unsupported: saveCanvas2 :: P5 -> UnsupportedProduct(Unsupported(HTMLCanvasElement)|Element) -> (Maybe String) -> (Maybe String) -> (Effect Unit) 31 | 32 | -- TODO: unsupported: saveFrames :: P5 -> String -> String -> Number -> Number -> Unsupported(Function(Array)) -> (Effect Unit) 33 | -------------------------------------------------------------------------------- /src/P5/Image/LoadingAndDisplaying.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | 11 | exports.imageImpl = function(p, img, x, y, width, height) { 12 | return function() { 13 | callP5(p, p.image, [img.value0, x, y, width.value0 !== undefined ? width.value0 : undefined, height.value0 !== undefined ? height.value0 : undefined]); 14 | }; 15 | }; 16 | exports.image2Impl = function(p, img, dx, dy, dWidth, dHeight, sx, sy, sWidth, sHeight) { 17 | return function() { 18 | callP5(p, p.image, [img.value0, dx, dy, dWidth, dHeight, sx, sy, sWidth.value0 !== undefined ? sWidth.value0 : undefined, sHeight.value0 !== undefined ? sHeight.value0 : undefined]); 19 | }; 20 | }; 21 | exports.imageModeImpl = function(p, mode) { 22 | return function() { 23 | callP5(p, p.imageMode, [p[mode.constructor.name.replace(new RegExp('^IMAGE_MODE_'), '')]]); 24 | }; 25 | }; 26 | exports.loadImageImpl = function(p, path, successCallback, failureCallback) { 27 | return callP5(p, p.loadImage, [ 28 | path, 29 | successCallback.value0 !== undefined ? function(img) { 30 | successCallback.value0(img)(); 31 | } : undefined, 32 | failureCallback.value0 !== undefined ? 33 | failureCallback.value0 : undefined 34 | ]); 35 | }; 36 | exports.noTintImpl = function(p) { 37 | return function() { 38 | callP5(p, p.noTint, []); 39 | }; 40 | }; 41 | exports.tintImpl = function(p, value) { 42 | return function() { 43 | callP5(p, p.tint, [value]); 44 | }; 45 | }; 46 | exports.tint2Impl = function(p, values) { 47 | return function() { 48 | callP5(p, p.tint, [values]); 49 | }; 50 | }; 51 | exports.tint3Impl = function(p, color) { 52 | return function() { 53 | callP5(p, p.tint, [color]); 54 | }; 55 | }; 56 | exports.tint4Impl = function(p, gray, alpha) { 57 | return function() { 58 | callP5(p, p.tint, [gray, alpha.value0 !== undefined ? alpha.value0 : undefined]); 59 | }; 60 | }; 61 | exports.tint5Impl = function(p, v1, v2, v3, alpha) { 62 | return function() { 63 | callP5(p, p.tint, [v1, v2, v3, alpha.value0 !== undefined ? alpha.value0 : undefined]); 64 | }; 65 | }; 66 | -------------------------------------------------------------------------------- /src/P5/Image/Pixels.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.blendImpl = function(p, sx, sy, sw, sh, dx, dy, dw, dh, blendMode) { 11 | return function() { 12 | callP5(p, p.blend, [sx, sy, sw, sh, dx, dy, dw, dh, p[blendMode.constructor.name.replace(new RegExp('^BLEND_MODE_'), '')]]); 13 | }; 14 | }; 15 | exports.copyImpl = function(p, sx, sy, sw, sh, dx, dy, dw, dh) { 16 | return function() { 17 | callP5(p, p.copy, [sx, sy, sw, sh, dx, dy, dw, dh]); 18 | }; 19 | }; 20 | exports.copy2Impl = function(p, srcImage, sx, sy, sw, sh, dx, dy, dw, dh) { 21 | return function() { 22 | callP5(p, p.copy, [srcImage.value0, sx, sy, sw, sh, dx, dy, dw, dh]); 23 | }; 24 | }; 25 | exports.filterImpl = function(p, filterType, filterParam) { 26 | return function() { 27 | callP5(p, p.filter, [p[filterType.constructor.name.replace(new RegExp('^FILTER_TYPE_'), '')], filterParam.value0 !== undefined ? filterParam.value0 : undefined]); 28 | }; 29 | }; 30 | exports.getImpl = function(p, x, y, w, h) { 31 | return callP5(p, p.get, [x.value0 !== undefined ? x.value0 : undefined, y.value0 !== undefined ? y.value0 : undefined, w.value0 !== undefined ? w.value0 : undefined, h.value0 !== undefined ? h.value0 : undefined]); 32 | }; 33 | exports.loadPixelsImpl = function(p) { 34 | return function() { 35 | callP5(p, p.loadPixels, []); 36 | }; 37 | }; 38 | exports.setImpl = function(p, x, y, c) { 39 | return function() { 40 | callP5(p, p.set, [x, y, c.value0]); 41 | }; 42 | }; 43 | exports.updatePixelsImpl = function(p, x, y, w, h) { 44 | return function() { 45 | callP5(p, p.updatePixels, [x.value0 !== undefined ? x.value0 : undefined, y.value0 !== undefined ? y.value0 : undefined, w.value0 !== undefined ? w.value0 : undefined, h.value0 !== undefined ? h.value0 : undefined]); 46 | }; 47 | }; -------------------------------------------------------------------------------- /src/P5/Image/Pixels.purs: -------------------------------------------------------------------------------- 1 | module P5.Image.Pixels 2 | ( blend 3 | , copy 4 | , copy2 5 | , filter 6 | , get 7 | , loadPixels 8 | , set 9 | , updatePixels 10 | ) where 11 | 12 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 13 | import Effect (Effect) 14 | import Prelude (Unit) 15 | import P5.Types 16 | import Foreign (Foreign, unsafeToForeign) 17 | import Data.Maybe (Maybe, maybe) 18 | import Foreign.NullOrUndefined (undefined) 19 | 20 | 21 | 22 | foreign import blendImpl :: Fn10 P5 Int Int Int Int Int Int Int Int BlendMode (Effect Unit) 23 | foreign import copyImpl :: Fn9 P5 Int Int Int Int Int Int Int Int (Effect Unit) 24 | foreign import copy2Impl :: Fn10 P5 ElementOrImage Int Int Int Int Int Int Int Int (Effect Unit) 25 | foreign import filterImpl :: Fn3 P5 FilterType (Maybe Number) (Effect Unit) 26 | foreign import getImpl :: Fn5 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) ArrayNumberOrImage 27 | foreign import loadPixelsImpl :: Fn1 P5 (Effect Unit) 28 | foreign import setImpl :: Fn4 P5 Number Number NumberOrArrayNumberOrColorOrImage (Effect Unit) 29 | foreign import updatePixelsImpl :: Fn5 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 30 | 31 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/blend) 32 | blend :: P5 -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> BlendMode -> (Effect Unit) 33 | blend p5 sx sy sw sh dx dy dw dh blendMode = runFn10 blendImpl p5 sx sy sw sh dx dy dw dh blendMode 34 | 35 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/copy) 36 | copy :: P5 -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> (Effect Unit) 37 | copy p5 sx sy sw sh dx dy dw dh = runFn9 copyImpl p5 sx sy sw sh dx dy dw dh 38 | 39 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/copy) 40 | copy2 :: P5 -> ElementOrImage -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> (Effect Unit) 41 | copy2 p5 srcImage sx sy sw sh dx dy dw dh = runFn10 copy2Impl p5 srcImage sx sy sw sh dx dy dw dh 42 | 43 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/filter) 44 | filter :: P5 -> FilterType -> (Maybe Number) -> (Effect Unit) 45 | filter p5 filterType filterParam = runFn3 filterImpl p5 filterType filterParam 46 | 47 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/get) 48 | get :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> ArrayNumberOrImage 49 | get p5 x y w h = runFn5 getImpl p5 x y w h 50 | 51 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadPixels) 52 | loadPixels :: P5 -> (Effect Unit) 53 | loadPixels p5 = runFn1 loadPixelsImpl p5 54 | 55 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/set) 56 | set :: P5 -> Number -> Number -> NumberOrArrayNumberOrColorOrImage -> (Effect Unit) 57 | set p5 x y c = runFn4 setImpl p5 x y c 58 | 59 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/updatePixels) 60 | updatePixels :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 61 | updatePixels p5 x y w h = runFn5 updatePixelsImpl p5 x y w h 62 | -------------------------------------------------------------------------------- /src/P5/LightsAndCamera.purs: -------------------------------------------------------------------------------- 1 | module P5.LightsAndCamera 2 | ( module P5.LightsAndCamera.Lights 3 | , module P5.LightsAndCamera.Material 4 | , module P5.LightsAndCamera.Camera 5 | , module P5.LightsAndCamera.Interaction 6 | ) where 7 | 8 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 9 | import Effect (Effect) 10 | import Prelude (Unit) 11 | import P5.Types 12 | import Foreign (Foreign, unsafeToForeign) 13 | import Data.Maybe (Maybe, maybe) 14 | import Foreign.NullOrUndefined (undefined) 15 | 16 | import P5.LightsAndCamera.Lights 17 | import P5.LightsAndCamera.Material 18 | import P5.LightsAndCamera.Camera 19 | import P5.LightsAndCamera.Interaction 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Camera.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.cameraImpl = function(p, x, y, z, centerX, centerY, centerZ, upX, upY, upZ) { 11 | return function() { 12 | callP5(p, p.camera, [x.value0 !== undefined ? x.value0 : undefined, y.value0 !== undefined ? y.value0 : undefined, z.value0 !== undefined ? z.value0 : undefined, centerX.value0 !== undefined ? centerX.value0 : undefined, centerY.value0 !== undefined ? centerY.value0 : undefined, centerZ.value0 !== undefined ? centerZ.value0 : undefined, upX.value0 !== undefined ? upX.value0 : undefined, upY.value0 !== undefined ? upY.value0 : undefined, upZ.value0 !== undefined ? upZ.value0 : undefined]); 13 | }; 14 | }; 15 | exports.createCameraImpl = function(p) { 16 | return callP5(p, p.createCamera, []); 17 | }; 18 | exports.orthoImpl = function(p, left, right, bottom, top, near, far) { 19 | return function() { 20 | callP5(p, p.ortho, [left.value0 !== undefined ? left.value0 : undefined, right.value0 !== undefined ? right.value0 : undefined, bottom.value0 !== undefined ? bottom.value0 : undefined, top.value0 !== undefined ? top.value0 : undefined, near.value0 !== undefined ? near.value0 : undefined, far.value0 !== undefined ? far.value0 : undefined]); 21 | }; 22 | }; 23 | exports.perspectiveImpl = function(p, fovy, aspect, near, far) { 24 | return function() { 25 | callP5(p, p.perspective, [fovy.value0 !== undefined ? fovy.value0 : undefined, aspect.value0 !== undefined ? aspect.value0 : undefined, near.value0 !== undefined ? near.value0 : undefined, far.value0 !== undefined ? far.value0 : undefined]); 26 | }; 27 | }; 28 | exports.setCameraImpl = function(p, cam) { 29 | return function() { 30 | callP5(p, p.setCamera, [cam]); 31 | }; 32 | }; -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Camera.purs: -------------------------------------------------------------------------------- 1 | module P5.LightsAndCamera.Camera 2 | ( camera 3 | , createCamera 4 | , ortho 5 | , perspective 6 | , setCamera 7 | ) where 8 | 9 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 10 | import Effect (Effect) 11 | import Prelude (Unit) 12 | import P5.Types 13 | import Foreign (Foreign, unsafeToForeign) 14 | import Data.Maybe (Maybe, maybe) 15 | import Foreign.NullOrUndefined (undefined) 16 | 17 | 18 | 19 | foreign import cameraImpl :: Fn10 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 20 | foreign import createCameraImpl :: Fn1 P5 Camera 21 | foreign import orthoImpl :: Fn7 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 22 | foreign import perspectiveImpl :: Fn5 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 23 | foreign import setCameraImpl :: Fn2 P5 Camera (Effect Unit) 24 | 25 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/camera) 26 | camera :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 27 | camera p5 x y z centerX centerY centerZ upX upY upZ = runFn10 cameraImpl p5 x y z centerX centerY centerZ upX upY upZ 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createCamera) 30 | createCamera :: P5 -> Camera 31 | createCamera p5 = runFn1 createCameraImpl p5 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/ortho) 34 | ortho :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 35 | ortho p5 left right bottom top near far = runFn7 orthoImpl p5 left right bottom top near far 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/perspective) 38 | perspective :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 39 | perspective p5 fovy aspect near far = runFn5 perspectiveImpl p5 fovy aspect near far 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/setCamera) 42 | setCamera :: P5 -> Camera -> (Effect Unit) 43 | setCamera p5 cam = runFn2 setCameraImpl p5 cam 44 | -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Interaction.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.debugModeImpl = function(p) { 11 | return function() { 12 | callP5(p, p.debugMode, []); 13 | }; 14 | }; 15 | exports.debugMode2Impl = function(p, mode) { 16 | return function() { 17 | callP5(p, p.debugMode, [p[mode.constructor.name.replace(new RegExp('^DEBUG_MODE_'), '')]]); 18 | }; 19 | }; 20 | exports.debugMode3Impl = function(p, mode, axesSize, xOff, yOff, zOff) { 21 | return function() { 22 | callP5(p, p.debugMode, [p[mode.constructor.name.replace(new RegExp('^DEBUG_MODE_'), '')], axesSize.value0 !== undefined ? axesSize.value0 : undefined, xOff.value0 !== undefined ? xOff.value0 : undefined, yOff.value0 !== undefined ? yOff.value0 : undefined, zOff.value0 !== undefined ? zOff.value0 : undefined]); 23 | }; 24 | }; 25 | exports.debugMode4Impl = function(p, mode, gridSize, gridDivisions, xOff, yOff, zOff) { 26 | return function() { 27 | callP5(p, p.debugMode, [p[mode.constructor.name.replace(new RegExp('^DEBUG_MODE_'), '')], gridSize.value0 !== undefined ? gridSize.value0 : undefined, gridDivisions.value0 !== undefined ? gridDivisions.value0 : undefined, xOff.value0 !== undefined ? xOff.value0 : undefined, yOff.value0 !== undefined ? yOff.value0 : undefined, zOff.value0 !== undefined ? zOff.value0 : undefined]); 28 | }; 29 | }; 30 | exports.debugMode5Impl = function(p, gridSize, gridDivisions, gridXOff, gridYOff, gridZOff, axesSize, axesXOff, axesYOff, axesZOff) { 31 | return function() { 32 | callP5(p, p.debugMode, [gridSize.value0 !== undefined ? gridSize.value0 : undefined, gridDivisions.value0 !== undefined ? gridDivisions.value0 : undefined, gridXOff.value0 !== undefined ? gridXOff.value0 : undefined, gridYOff.value0 !== undefined ? gridYOff.value0 : undefined, gridZOff.value0 !== undefined ? gridZOff.value0 : undefined, axesSize.value0 !== undefined ? axesSize.value0 : undefined, axesXOff.value0 !== undefined ? axesXOff.value0 : undefined, axesYOff.value0 !== undefined ? axesYOff.value0 : undefined, axesZOff.value0 !== undefined ? axesZOff.value0 : undefined]); 33 | }; 34 | }; 35 | exports.noDebugModeImpl = function(p) { 36 | return function() { 37 | callP5(p, p.noDebugMode, []); 38 | }; 39 | }; 40 | exports.orbitControlImpl = function(p, sensitivityX, sensitivityY) { 41 | return function() { 42 | callP5(p, p.orbitControl, [sensitivityX.value0 !== undefined ? sensitivityX.value0 : undefined, sensitivityY.value0 !== undefined ? sensitivityY.value0 : undefined]); 43 | }; 44 | }; -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Interaction.purs: -------------------------------------------------------------------------------- 1 | module P5.LightsAndCamera.Interaction 2 | ( debugMode 3 | , debugMode2 4 | , debugMode3 5 | , debugMode4 6 | , debugMode5 7 | , noDebugMode 8 | , orbitControl 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import debugModeImpl :: Fn1 P5 (Effect Unit) 22 | foreign import debugMode2Impl :: Fn2 P5 DebugMode (Effect Unit) 23 | foreign import debugMode3Impl :: Fn6 P5 DebugMode (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 24 | foreign import debugMode4Impl :: Fn7 P5 DebugMode (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 25 | foreign import debugMode5Impl :: Fn10 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 26 | foreign import noDebugModeImpl :: Fn1 P5 (Effect Unit) 27 | foreign import orbitControlImpl :: Fn3 P5 (Maybe Number) (Maybe Number) (Effect Unit) 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 30 | debugMode :: P5 -> (Effect Unit) 31 | debugMode p5 = runFn1 debugModeImpl p5 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 34 | debugMode2 :: P5 -> DebugMode -> (Effect Unit) 35 | debugMode2 p5 mode = runFn2 debugMode2Impl p5 mode 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 38 | debugMode3 :: P5 -> DebugMode -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 39 | debugMode3 p5 mode axesSize xOff yOff zOff = runFn6 debugMode3Impl p5 mode axesSize xOff yOff zOff 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 42 | debugMode4 :: P5 -> DebugMode -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 43 | debugMode4 p5 mode gridSize gridDivisions xOff yOff zOff = runFn7 debugMode4Impl p5 mode gridSize gridDivisions xOff yOff zOff 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/debugMode) 46 | debugMode5 :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 47 | debugMode5 p5 gridSize gridDivisions gridXOff gridYOff gridZOff axesSize axesXOff axesYOff axesZOff = runFn10 debugMode5Impl p5 gridSize gridDivisions gridXOff gridYOff gridZOff axesSize axesXOff axesYOff axesZOff 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noDebugMode) 50 | noDebugMode :: P5 -> (Effect Unit) 51 | noDebugMode p5 = runFn1 noDebugModeImpl p5 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/orbitControl) 54 | orbitControl :: P5 -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 55 | orbitControl p5 sensitivityX sensitivityY = runFn3 orbitControlImpl p5 sensitivityX sensitivityY 56 | -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Lights.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.ambientLightImpl = function(p, value) { 11 | return function() { 12 | callP5(p, p.ambientLight, [value]); 13 | }; 14 | }; 15 | exports.ambientLight2Impl = function(p, values) { 16 | return function() { 17 | callP5(p, p.ambientLight, [values]); 18 | }; 19 | }; 20 | exports.ambientLight3Impl = function(p, color) { 21 | return function() { 22 | callP5(p, p.ambientLight, [color]); 23 | }; 24 | }; 25 | exports.ambientLight4Impl = function(p, gray, alpha) { 26 | return function() { 27 | callP5(p, p.ambientLight, [gray, alpha.value0 !== undefined ? alpha.value0 : undefined]); 28 | }; 29 | }; 30 | exports.ambientLight5Impl = function(p, v1, v2, v3, alpha) { 31 | return function() { 32 | callP5(p, p.ambientLight, [v1, v2, v3, alpha.value0 !== undefined ? alpha.value0 : undefined]); 33 | }; 34 | }; 35 | exports.directionalLightImpl = function(p, color, position) { 36 | return function() { 37 | callP5(p, p.directionalLight, [color.value0, position]); 38 | }; 39 | }; 40 | exports.directionalLight2Impl = function(p, v1, v2, v3, position) { 41 | return function() { 42 | callP5(p, p.directionalLight, [v1, v2, v3, position]); 43 | }; 44 | }; 45 | exports.directionalLight3Impl = function(p, color, x, y, z) { 46 | return function() { 47 | callP5(p, p.directionalLight, [color.value0, x, y, z]); 48 | }; 49 | }; 50 | exports.directionalLight4Impl = function(p, v1, v2, v3, x, y, z) { 51 | return function() { 52 | callP5(p, p.directionalLight, [v1, v2, v3, x, y, z]); 53 | }; 54 | }; 55 | exports.pointLightImpl = function(p, color, position) { 56 | return function() { 57 | callP5(p, p.pointLight, [color.value0, position]); 58 | }; 59 | }; 60 | exports.pointLight2Impl = function(p, v1, v2, v3, position) { 61 | return function() { 62 | callP5(p, p.pointLight, [v1, v2, v3, position]); 63 | }; 64 | }; 65 | exports.pointLight3Impl = function(p, color, x, y, z) { 66 | return function() { 67 | callP5(p, p.pointLight, [color.value0, x, y, z]); 68 | }; 69 | }; 70 | exports.pointLight4Impl = function(p, v1, v2, v3, x, y, z) { 71 | return function() { 72 | callP5(p, p.pointLight, [v1, v2, v3, x, y, z]); 73 | }; 74 | }; -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Material.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.ambientMaterialImpl = function(p, color) { 11 | return function() { 12 | callP5(p, p.ambientMaterial, [color.value0]); 13 | }; 14 | }; 15 | exports.ambientMaterial2Impl = function(p, v1, v2, v3, a) { 16 | return function() { 17 | callP5(p, p.ambientMaterial, [v1, v2.value0 !== undefined ? v2.value0 : undefined, v3.value0 !== undefined ? v3.value0 : undefined, a.value0 !== undefined ? a.value0 : undefined]); 18 | }; 19 | }; 20 | exports.createShaderImpl = function(p, vertSrc, fragSrc) { 21 | return callP5(p, p.createShader, [vertSrc, fragSrc]); 22 | }; 23 | exports.loadShaderImpl = function(p, vertFilename, fragFilename) { 24 | return callP5(p, p.loadShader, [vertFilename.value0 !== undefined ? vertFilename.value0 : undefined, fragFilename.value0 !== undefined ? fragFilename.value0 : undefined]); 25 | }; 26 | exports.normalMaterialImpl = function(p) { 27 | return function() { 28 | callP5(p, p.normalMaterial, []); 29 | }; 30 | }; 31 | exports.shaderImpl = function(p, s) { 32 | return function() { 33 | callP5(p, p.shader, [s.value0 !== undefined ? s.value0 : undefined]); 34 | }; 35 | }; 36 | exports.specularMaterialImpl = function(p, color) { 37 | return function() { 38 | callP5(p, p.specularMaterial, [color.value0]); 39 | }; 40 | }; 41 | exports.specularMaterial2Impl = function(p, v1, v2, v3, a) { 42 | return function() { 43 | callP5(p, p.specularMaterial, [v1, v2.value0 !== undefined ? v2.value0 : undefined, v3.value0 !== undefined ? v3.value0 : undefined, a.value0 !== undefined ? a.value0 : undefined]); 44 | }; 45 | }; 46 | exports.textureImpl = function(p, tex) { 47 | return function() { 48 | callP5(p, p.texture, [tex.value0]); 49 | }; 50 | }; -------------------------------------------------------------------------------- /src/P5/LightsAndCamera/Material.purs: -------------------------------------------------------------------------------- 1 | module P5.LightsAndCamera.Material 2 | ( ambientMaterial 3 | , ambientMaterial2 4 | , createShader 5 | , loadShader 6 | , normalMaterial 7 | , shader 8 | , specularMaterial 9 | , specularMaterial2 10 | , texture 11 | ) where 12 | 13 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 14 | import Effect (Effect) 15 | import Prelude (Unit) 16 | import P5.Types 17 | import Foreign (Foreign, unsafeToForeign) 18 | import Data.Maybe (Maybe, maybe) 19 | import Foreign.NullOrUndefined (undefined) 20 | 21 | 22 | 23 | foreign import ambientMaterialImpl :: Fn2 P5 ArrayNumberOrStringOrColor (Effect Unit) 24 | foreign import ambientMaterial2Impl :: Fn5 P5 Number (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 25 | foreign import createShaderImpl :: Fn3 P5 String String Shader 26 | foreign import loadShaderImpl :: Fn3 P5 (Maybe String) (Maybe String) Shader 27 | foreign import normalMaterialImpl :: Fn1 P5 (Effect Unit) 28 | foreign import shaderImpl :: Fn2 P5 (Maybe Shader) (Effect Unit) 29 | foreign import specularMaterialImpl :: Fn2 P5 ArrayNumberOrStringOrColor (Effect Unit) 30 | foreign import specularMaterial2Impl :: Fn5 P5 Number (Maybe Number) (Maybe Number) (Maybe Number) (Effect Unit) 31 | foreign import textureImpl :: Fn2 P5 GraphicsOrImageOrMediaElement (Effect Unit) 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientMaterial) 34 | ambientMaterial :: P5 -> ArrayNumberOrStringOrColor -> (Effect Unit) 35 | ambientMaterial p5 color = runFn2 ambientMaterialImpl p5 color 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/ambientMaterial) 38 | ambientMaterial2 :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 39 | ambientMaterial2 p5 v1 v2 v3 a = runFn5 ambientMaterial2Impl p5 v1 v2 v3 a 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createShader) 42 | createShader :: P5 -> String -> String -> Shader 43 | createShader p5 vertSrc fragSrc = runFn3 createShaderImpl p5 vertSrc fragSrc 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadShader) 46 | loadShader :: P5 -> (Maybe String) -> (Maybe String) -> Shader 47 | loadShader p5 vertFilename fragFilename = runFn3 loadShaderImpl p5 vertFilename fragFilename 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/normalMaterial) 50 | normalMaterial :: P5 -> (Effect Unit) 51 | normalMaterial p5 = runFn1 normalMaterialImpl p5 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/shader) 54 | shader :: P5 -> (Maybe Shader) -> (Effect Unit) 55 | shader p5 s = runFn2 shaderImpl p5 s 56 | 57 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/specularMaterial) 58 | specularMaterial :: P5 -> ArrayNumberOrStringOrColor -> (Effect Unit) 59 | specularMaterial p5 color = runFn2 specularMaterialImpl p5 color 60 | 61 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/specularMaterial) 62 | specularMaterial2 :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 63 | specularMaterial2 p5 v1 v2 v3 a = runFn5 specularMaterial2Impl p5 v1 v2 v3 a 64 | 65 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/texture) 66 | texture :: P5 -> GraphicsOrImageOrMediaElement -> (Effect Unit) 67 | texture p5 tex = runFn2 textureImpl p5 tex 68 | -------------------------------------------------------------------------------- /src/P5/Math.purs: -------------------------------------------------------------------------------- 1 | module P5.Math 2 | ( createVector 3 | , module P5.Math.Calculation 4 | , module P5.Math.Trigonometry 5 | , module P5.Math.Noise 6 | , module P5.Math.Random 7 | ) where 8 | 9 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 10 | import Effect (Effect) 11 | import Prelude (Unit) 12 | import P5.Types 13 | import Foreign (Foreign, unsafeToForeign) 14 | import Data.Maybe (Maybe, maybe) 15 | import Foreign.NullOrUndefined (undefined) 16 | 17 | import P5.Math.Calculation 18 | import P5.Math.Trigonometry 19 | import P5.Math.Noise 20 | import P5.Math.Random 21 | 22 | foreign import createVectorImpl :: Fn4 P5 (Maybe Number) (Maybe Number) (Maybe Number) Vector 23 | 24 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createVector) 25 | createVector :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> Vector 26 | createVector p5 x y z = runFn4 createVectorImpl p5 x y z 27 | -------------------------------------------------------------------------------- /src/P5/Math/Calculation.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.absImpl = function(p, n) { 11 | return callP5(p, p.abs, [n]); 12 | }; 13 | exports.ceilImpl = function(p, n) { 14 | return callP5(p, p.ceil, [n]); 15 | }; 16 | exports.constrainImpl = function(p, n, low, high) { 17 | return callP5(p, p.constrain, [n, low, high]); 18 | }; 19 | exports.distImpl = function(p, x1, y1, x2, y2) { 20 | return callP5(p, p.dist, [x1, y1, x2, y2]); 21 | }; 22 | exports.dist2Impl = function(p, x1, y1, z1, x2, y2, z2) { 23 | return callP5(p, p.dist, [x1, y1, z1, x2, y2, z2]); 24 | }; 25 | exports.expImpl = function(p, n) { 26 | return callP5(p, p.exp, [n]); 27 | }; 28 | exports.floorImpl = function(p, n) { 29 | return callP5(p, p.floor, [n]); 30 | }; 31 | exports.lerpImpl = function(p, start, stop, amt) { 32 | return callP5(p, p.lerp, [start, stop, amt]); 33 | }; 34 | exports.logImpl = function(p, n) { 35 | return callP5(p, p.log, [n]); 36 | }; 37 | exports.magImpl = function(p, a, b) { 38 | return callP5(p, p.mag, [a, b]); 39 | }; 40 | exports.mapImpl = function(p, value, start1, stop1, start2, stop2, withinBounds) { 41 | return callP5(p, p.map, [value, start1, stop1, start2, stop2, withinBounds.value0 !== undefined ? withinBounds.value0 : undefined]); 42 | }; 43 | exports.maxImpl = function(p, nums) { 44 | return callP5(p, p.max, [nums]); 45 | }; 46 | exports.max2Impl = function(p, n0, n1) { 47 | return callP5(p, p.max, [n0, n1]); 48 | }; 49 | exports.minImpl = function(p, nums) { 50 | return callP5(p, p.min, [nums]); 51 | }; 52 | exports.min2Impl = function(p, n0, n1) { 53 | return callP5(p, p.min, [n0, n1]); 54 | }; 55 | exports.normImpl = function(p, value, start, stop) { 56 | return callP5(p, p.norm, [value, start, stop]); 57 | }; 58 | exports.powImpl = function(p, n, e) { 59 | return callP5(p, p.pow, [n, e]); 60 | }; 61 | exports.roundImpl = function(p, n) { 62 | return callP5(p, p.round, [n]); 63 | }; 64 | exports.sqImpl = function(p, n) { 65 | return callP5(p, p.sq, [n]); 66 | }; 67 | exports.sqrtImpl = function(p, n) { 68 | return callP5(p, p.sqrt, [n]); 69 | }; -------------------------------------------------------------------------------- /src/P5/Math/Noise.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.noiseDetailImpl = function(p, lod, falloff) { 11 | return function() { 12 | callP5(p, p.noiseDetail, [lod, falloff]); 13 | }; 14 | }; 15 | exports.noiseSeedImpl = function(p, seed) { 16 | return function() { 17 | callP5(p, p.noiseSeed, [seed]); 18 | }; 19 | }; 20 | exports.noiseImpl = function(p, x, y, z) { 21 | return function() { 22 | return callP5(p, p.noise, [x, y.value0 !== undefined ? y.value0 : undefined, z.value0 !== undefined ? z.value0 : undefined]); 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /src/P5/Math/Noise.purs: -------------------------------------------------------------------------------- 1 | module P5.Math.Noise 2 | ( noiseDetail 3 | , noiseSeed 4 | , noise 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | foreign import noiseDetailImpl :: Fn3 P5 Number Number (Effect Unit) 16 | foreign import noiseSeedImpl :: Fn2 P5 Number (Effect Unit) 17 | foreign import noiseImpl :: Fn4 P5 Number (Maybe Number) (Maybe Number) (Effect Number) 18 | 19 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noiseDetail) 20 | noiseDetail :: P5 -> Number -> Number -> (Effect Unit) 21 | noiseDetail p5 lod falloff = runFn3 noiseDetailImpl p5 lod falloff 22 | 23 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noiseSeed) 24 | noiseSeed :: P5 -> Number -> (Effect Unit) 25 | noiseSeed p5 seed = runFn2 noiseSeedImpl p5 seed 26 | 27 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noise) 28 | noise :: P5 -> Number -> (Maybe Number) -> (Maybe Number) -> Effect Number 29 | noise p5 x y z = runFn4 noiseImpl p5 x y z 30 | 31 | -------------------------------------------------------------------------------- /src/P5/Math/Random.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | 11 | exports.random2Impl = function(p, min, max) { 12 | return function() { 13 | return callP5(p, p.random, [min.value0 !== undefined ? min.value0 : undefined, max.value0 !== undefined ? max.value0 : undefined]); 14 | }; 15 | }; 16 | 17 | exports.randomSeedImpl = function(p, seed) { 18 | return function() { 19 | callP5(p, p.randomSeed, [seed]); 20 | }; 21 | }; 22 | 23 | exports.randomGaussianImpl = function(p, mean, sd) { 24 | return function() { 25 | return callP5(p, p.randomGaussian, [mean, sd]); 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /src/P5/Math/Random.purs: -------------------------------------------------------------------------------- 1 | module P5.Math.Random 2 | ( randomSeed 3 | , randomGaussian 4 | , random2 5 | ) where 6 | 7 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 8 | import Effect (Effect) 9 | import Prelude (Unit) 10 | import P5.Types 11 | import Foreign (Foreign, unsafeToForeign) 12 | import Data.Maybe (Maybe, maybe) 13 | import Foreign.NullOrUndefined (undefined) 14 | 15 | foreign import random2Impl :: Fn3 P5 (Maybe Number) (Maybe Number) (Effect Number) 16 | foreign import randomSeedImpl :: Fn2 P5 Number (Effect Unit) 17 | foreign import randomGaussianImpl :: Fn3 P5 Number Number (Effect Number) 18 | 19 | -- TODO: unsupported: random :: P5 -> Unsupported(Array) -> Unsupported(*) 20 | 21 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/random) 22 | random2 :: P5 -> (Maybe Number) -> (Maybe Number) -> Effect Number 23 | random2 p5 min max = runFn3 random2Impl p5 min max 24 | 25 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/randomSeed) 26 | randomSeed :: P5 -> Number -> (Effect Unit) 27 | randomSeed p5 seed = runFn2 randomSeedImpl p5 seed 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/randomGaussian) 30 | randomGaussian :: P5 -> Number -> Number -> Effect Number 31 | randomGaussian p5 mean sd = runFn3 randomGaussianImpl p5 mean sd 32 | 33 | -------------------------------------------------------------------------------- /src/P5/Math/Trigonometry.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.acosImpl = function(p, value) { 11 | return callP5(p, p.acos, [value]); 12 | }; 13 | exports.angleModeImpl = function(p, mode) { 14 | return function() { 15 | callP5(p, p.angleMode, [p[mode.constructor.name.replace(new RegExp('^ANGLE_MODE_'), '')]]); 16 | }; 17 | }; 18 | exports.asinImpl = function(p, value) { 19 | return callP5(p, p.asin, [value]); 20 | }; 21 | exports.atanImpl = function(p, value) { 22 | return callP5(p, p.atan, [value]); 23 | }; 24 | exports.atan2Impl = function(p, y, x) { 25 | return callP5(p, p.atan2, [y, x]); 26 | }; 27 | exports.cosImpl = function(p, angle) { 28 | return callP5(p, p.cos, [angle]); 29 | }; 30 | exports.degreesImpl = function(p, radians) { 31 | return callP5(p, p.degrees, [radians]); 32 | }; 33 | exports.radiansImpl = function(p, degrees) { 34 | return callP5(p, p.radians, [degrees]); 35 | }; 36 | exports.sinImpl = function(p, angle) { 37 | return callP5(p, p.sin, [angle]); 38 | }; 39 | exports.tanImpl = function(p, angle) { 40 | return callP5(p, p.tan, [angle]); 41 | }; -------------------------------------------------------------------------------- /src/P5/Math/Trigonometry.purs: -------------------------------------------------------------------------------- 1 | module P5.Math.Trigonometry 2 | ( acos 3 | , angleMode 4 | , asin 5 | , atan 6 | , atan2 7 | , cos 8 | , degrees 9 | , radians 10 | , sin 11 | , tan 12 | ) where 13 | 14 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 15 | import Effect (Effect) 16 | import Prelude (Unit) 17 | import P5.Types 18 | import Foreign (Foreign, unsafeToForeign) 19 | import Data.Maybe (Maybe, maybe) 20 | import Foreign.NullOrUndefined (undefined) 21 | 22 | 23 | 24 | foreign import acosImpl :: Fn2 P5 Number Number 25 | foreign import angleModeImpl :: Fn2 P5 AngleMode (Effect Unit) 26 | foreign import asinImpl :: Fn2 P5 Number Number 27 | foreign import atanImpl :: Fn2 P5 Number Number 28 | foreign import atan2Impl :: Fn3 P5 Number Number Number 29 | foreign import cosImpl :: Fn2 P5 Number Number 30 | foreign import degreesImpl :: Fn2 P5 Number Number 31 | foreign import radiansImpl :: Fn2 P5 Number Number 32 | foreign import sinImpl :: Fn2 P5 Number Number 33 | foreign import tanImpl :: Fn2 P5 Number Number 34 | 35 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/acos) 36 | acos :: P5 -> Number -> Number 37 | acos p5 value = runFn2 acosImpl p5 value 38 | 39 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/angleMode) 40 | angleMode :: P5 -> AngleMode -> (Effect Unit) 41 | angleMode p5 mode = runFn2 angleModeImpl p5 mode 42 | 43 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/asin) 44 | asin :: P5 -> Number -> Number 45 | asin p5 value = runFn2 asinImpl p5 value 46 | 47 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/atan) 48 | atan :: P5 -> Number -> Number 49 | atan p5 value = runFn2 atanImpl p5 value 50 | 51 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/atan2) 52 | atan2 :: P5 -> Number -> Number -> Number 53 | atan2 p5 y x = runFn3 atan2Impl p5 y x 54 | 55 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/cos) 56 | cos :: P5 -> Number -> Number 57 | cos p5 angle = runFn2 cosImpl p5 angle 58 | 59 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/degrees) 60 | degrees :: P5 -> Number -> Number 61 | degrees p5 radians = runFn2 degreesImpl p5 radians 62 | 63 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/radians) 64 | radians :: P5 -> Number -> Number 65 | radians p5 degrees = runFn2 radiansImpl p5 degrees 66 | 67 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/sin) 68 | sin :: P5 -> Number -> Number 69 | sin p5 angle = runFn2 sinImpl p5 angle 70 | 71 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/tan) 72 | tan :: P5 -> Number -> Number 73 | tan p5 angle = runFn2 tanImpl p5 angle 74 | -------------------------------------------------------------------------------- /src/P5/Rendering.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.blendModeImpl = function(p, mode) { 11 | return function() { 12 | callP5(p, p.blendMode, [p[mode.constructor.name.replace(new RegExp('^BLEND_MODE_'), '')]]); 13 | }; 14 | }; 15 | exports.createGraphicsImpl = function(p, w, h, renderer) { 16 | return callP5(p, p.createGraphics, [w, h, renderer.value0 !== undefined ? renderer.value0 : undefined]); 17 | }; 18 | exports.noCanvasImpl = function(p) { 19 | return function() { 20 | callP5(p, p.noCanvas, []); 21 | }; 22 | }; 23 | exports.resizeCanvasImpl = function(p, w, h, noRedraw) { 24 | return function() { 25 | callP5(p, p.resizeCanvas, [w, h, noRedraw.value0 !== undefined ? noRedraw.value0 : undefined]); 26 | }; 27 | }; 28 | exports.setAttributes2Impl = function(p, key, value) { 29 | return function() { 30 | callP5(p, p.setAttributes, [key, value]); 31 | }; 32 | }; 33 | exports.createCanvasImpl = function(p, w, h, r) { 34 | return function() { 35 | return callP5(p, p.createCanvas, [w, h, r.value0 !== undefined ? p[r.value0.constructor.name.replace(new RegExp('^CREATE_CANVAS_RENDERER_'), '')] : undefined]); 36 | }; 37 | }; 38 | -------------------------------------------------------------------------------- /src/P5/Rendering.purs: -------------------------------------------------------------------------------- 1 | module P5.Rendering 2 | ( blendMode 3 | , createGraphics 4 | , createCanvas 5 | , noCanvas 6 | , resizeCanvas 7 | , setAttributes2 8 | ) where 9 | 10 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 11 | import Effect (Effect) 12 | import Prelude (Unit) 13 | import P5.Types 14 | import Foreign (Foreign, unsafeToForeign) 15 | import Data.Maybe (Maybe, maybe) 16 | import Foreign.NullOrUndefined (undefined) 17 | 18 | foreign import createCanvasImpl 19 | :: Fn4 P5 Number Number (Maybe CreateCanvasRenderer) (Effect Element) 20 | foreign import blendModeImpl :: Fn2 P5 BlendMode (Effect Unit) 21 | foreign import createGraphicsImpl :: Fn4 P5 Number Number (Maybe CreateGraphicsRenderer) Graphics 22 | foreign import noCanvasImpl :: Fn1 P5 (Effect Unit) 23 | foreign import resizeCanvasImpl :: Fn4 P5 Number Number (Maybe Boolean) (Effect Unit) 24 | foreign import setAttributes2Impl :: Fn3 P5 String Boolean (Effect Unit) 25 | 26 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/blendMode) 27 | blendMode :: P5 -> BlendMode -> (Effect Unit) 28 | blendMode p5 mode = runFn2 blendModeImpl p5 mode 29 | 30 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createGraphics) 31 | createGraphics :: P5 -> Number -> Number -> (Maybe CreateGraphicsRenderer) -> Graphics 32 | createGraphics p5 w h renderer = runFn4 createGraphicsImpl p5 w h renderer 33 | 34 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noCanvas) 35 | noCanvas :: P5 -> (Effect Unit) 36 | noCanvas p5 = runFn1 noCanvasImpl p5 37 | 38 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/resizeCanvas) 39 | resizeCanvas :: P5 -> Number -> Number -> (Maybe Boolean) -> (Effect Unit) 40 | resizeCanvas p5 w h noRedraw = runFn4 resizeCanvasImpl p5 w h noRedraw 41 | 42 | -- TODO: unsupported: setAttributes :: P5 -> Unsupported(Object) -> (Effect Unit) 43 | 44 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/setAttributes) 45 | setAttributes2 :: P5 -> String -> Boolean -> (Effect Unit) 46 | setAttributes2 p5 key value = runFn3 setAttributes2Impl p5 key value 47 | 48 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/createCanvas) 49 | createCanvas :: P5 -> Number -> Number -> Maybe CreateCanvasRenderer -> Effect Element 50 | createCanvas p w h r = runFn4 createCanvasImpl p w h r 51 | 52 | -------------------------------------------------------------------------------- /src/P5/Shape.purs: -------------------------------------------------------------------------------- 1 | module P5.Shape 2 | ( module P5.Shape.TwoDPrimitives 3 | , module P5.Shape.Vertex 4 | , module P5.Shape.Curves 5 | , module P5.Shape.ThreeDPrimitives 6 | , module P5.Shape.Attributes 7 | , module P5.Shape.ThreeDModels 8 | ) where 9 | 10 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 11 | import Effect (Effect) 12 | import Prelude (Unit) 13 | import P5.Types 14 | import Foreign (Foreign, unsafeToForeign) 15 | import Data.Maybe (Maybe, maybe) 16 | import Foreign.NullOrUndefined (undefined) 17 | 18 | import P5.Shape.TwoDPrimitives 19 | import P5.Shape.Vertex 20 | import P5.Shape.Curves 21 | import P5.Shape.ThreeDPrimitives 22 | import P5.Shape.Attributes 23 | import P5.Shape.ThreeDModels 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/P5/Shape/Attributes.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.ellipseModeImpl = function(p, mode) { 11 | return function() { 12 | callP5(p, p.ellipseMode, [p[mode.constructor.name.replace(new RegExp('^ELLIPSE_MODE_'), '')]]); 13 | }; 14 | }; 15 | exports.noSmoothImpl = function(p) { 16 | return function() { 17 | callP5(p, p.noSmooth, []); 18 | }; 19 | }; 20 | exports.rectModeImpl = function(p, mode) { 21 | return function() { 22 | callP5(p, p.rectMode, [p[mode.constructor.name.replace(new RegExp('^RECT_MODE_'), '')]]); 23 | }; 24 | }; 25 | exports.smoothImpl = function(p) { 26 | return function() { 27 | callP5(p, p.smooth, []); 28 | }; 29 | }; 30 | exports.strokeCapImpl = function(p, cap) { 31 | return function() { 32 | callP5(p, p.strokeCap, [p[cap.constructor.name.replace(new RegExp('^STROKE_CAP_'), '')]]); 33 | }; 34 | }; 35 | exports.strokeJoinImpl = function(p, join) { 36 | return function() { 37 | callP5(p, p.strokeJoin, [p[join.constructor.name.replace(new RegExp('^STROKE_JOIN_'), '')]]); 38 | }; 39 | }; 40 | exports.strokeWeightImpl = function(p, weight) { 41 | return function() { 42 | callP5(p, p.strokeWeight, [weight]); 43 | }; 44 | }; -------------------------------------------------------------------------------- /src/P5/Shape/Attributes.purs: -------------------------------------------------------------------------------- 1 | module P5.Shape.Attributes 2 | ( ellipseMode 3 | , noSmooth 4 | , rectMode 5 | , smooth 6 | , strokeCap 7 | , strokeJoin 8 | , strokeWeight 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import ellipseModeImpl :: Fn2 P5 EllipseMode (Effect Unit) 22 | foreign import noSmoothImpl :: Fn1 P5 (Effect Unit) 23 | foreign import rectModeImpl :: Fn2 P5 RectMode (Effect Unit) 24 | foreign import smoothImpl :: Fn1 P5 (Effect Unit) 25 | foreign import strokeCapImpl :: Fn2 P5 StrokeCap (Effect Unit) 26 | foreign import strokeJoinImpl :: Fn2 P5 StrokeJoin (Effect Unit) 27 | foreign import strokeWeightImpl :: Fn2 P5 Number (Effect Unit) 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipseMode) 30 | ellipseMode :: P5 -> EllipseMode -> (Effect Unit) 31 | ellipseMode p5 mode = runFn2 ellipseModeImpl p5 mode 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noSmooth) 34 | noSmooth :: P5 -> (Effect Unit) 35 | noSmooth p5 = runFn1 noSmoothImpl p5 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/rectMode) 38 | rectMode :: P5 -> RectMode -> (Effect Unit) 39 | rectMode p5 mode = runFn2 rectModeImpl p5 mode 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/smooth) 42 | smooth :: P5 -> (Effect Unit) 43 | smooth p5 = runFn1 smoothImpl p5 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeCap) 46 | strokeCap :: P5 -> StrokeCap -> (Effect Unit) 47 | strokeCap p5 cap = runFn2 strokeCapImpl p5 cap 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeJoin) 50 | strokeJoin :: P5 -> StrokeJoin -> (Effect Unit) 51 | strokeJoin p5 join = runFn2 strokeJoinImpl p5 join 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/strokeWeight) 54 | strokeWeight :: P5 -> Number -> (Effect Unit) 55 | strokeWeight p5 weight = runFn2 strokeWeightImpl p5 weight 56 | -------------------------------------------------------------------------------- /src/P5/Shape/Curves.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.bezierImpl = function(p, x1, y1, x2, y2, x3, y3, x4, y4) { 11 | return function() { 12 | callP5(p, p.bezier, [x1, y1, x2, y2, x3, y3, x4, y4]); 13 | }; 14 | }; 15 | exports.bezierDetailImpl = function(p, detail) { 16 | return function() { 17 | callP5(p, p.bezierDetail, [detail]); 18 | }; 19 | }; 20 | exports.bezierPointImpl = function(p, a, b, c, d, t) { 21 | return callP5(p, p.bezierPoint, [a, b, c, d, t]); 22 | }; 23 | exports.bezierTangentImpl = function(p, a, b, c, d, t) { 24 | return callP5(p, p.bezierTangent, [a, b, c, d, t]); 25 | }; 26 | exports.curveImpl = function(p, x1, y1, x2, y2, x3, y3, x4, y4) { 27 | return function() { 28 | callP5(p, p.curve, [x1, y1, x2, y2, x3, y3, x4, y4]); 29 | }; 30 | }; 31 | exports.curveDetailImpl = function(p, resolution) { 32 | return function() { 33 | callP5(p, p.curveDetail, [resolution]); 34 | }; 35 | }; 36 | exports.curvePointImpl = function(p, a, b, c, d, t) { 37 | return callP5(p, p.curvePoint, [a, b, c, d, t]); 38 | }; 39 | exports.curveTangentImpl = function(p, a, b, c, d, t) { 40 | return callP5(p, p.curveTangent, [a, b, c, d, t]); 41 | }; 42 | exports.curveTightnessImpl = function(p, amount) { 43 | return function() { 44 | callP5(p, p.curveTightness, [amount]); 45 | }; 46 | }; -------------------------------------------------------------------------------- /src/P5/Shape/ThreeDModels.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.modelImpl = function(p, model) { 11 | return function() { 12 | callP5(p, p.model, [model]); 13 | }; 14 | }; -------------------------------------------------------------------------------- /src/P5/Shape/ThreeDModels.purs: -------------------------------------------------------------------------------- 1 | module P5.Shape.ThreeDModels 2 | ( model 3 | ) where 4 | 5 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 6 | import Effect (Effect) 7 | import Prelude (Unit) 8 | import P5.Types 9 | import Foreign (Foreign, unsafeToForeign) 10 | import Data.Maybe (Maybe, maybe) 11 | import Foreign.NullOrUndefined (undefined) 12 | 13 | 14 | 15 | foreign import modelImpl :: Fn2 P5 Geometry (Effect Unit) 16 | 17 | -- TODO: unsupported: loadModel :: P5 -> String -> Unsupported(function(p5.Geometry)) -> Unsupported(Function(Event)) -> Geometry 18 | 19 | -- TODO: unsupported: loadModel2 :: P5 -> String -> Boolean -> Unsupported(function(p5.Geometry)) -> Unsupported(Function(Event)) -> Geometry 20 | 21 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/model) 22 | model :: P5 -> Geometry -> (Effect Unit) 23 | model p5 model = runFn2 modelImpl p5 model 24 | -------------------------------------------------------------------------------- /src/P5/Shape/ThreeDPrimitives.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.boxImpl = function(p, width, height, depth, detailX, detailY) { 11 | return function() { 12 | callP5(p, p.box, [width.value0 !== undefined ? width.value0 : undefined, height.value0 !== undefined ? height.value0 : undefined, depth.value0 !== undefined ? depth.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 13 | }; 14 | }; 15 | exports.coneImpl = function(p, radius, height, detailX, detailY, cap) { 16 | return function() { 17 | callP5(p, p.cone, [radius.value0 !== undefined ? radius.value0 : undefined, height.value0 !== undefined ? height.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined, cap.value0 !== undefined ? cap.value0 : undefined]); 18 | }; 19 | }; 20 | exports.cylinderImpl = function(p, radius, height, detailX, detailY, bottomCap, topCap) { 21 | return function() { 22 | callP5(p, p.cylinder, [radius.value0 !== undefined ? radius.value0 : undefined, height.value0 !== undefined ? height.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined, bottomCap.value0 !== undefined ? bottomCap.value0 : undefined, topCap.value0 !== undefined ? topCap.value0 : undefined]); 23 | }; 24 | }; 25 | exports.ellipsoidImpl = function(p, radiusx, radiusy, radiusz, detailX, detailY) { 26 | return function() { 27 | callP5(p, p.ellipsoid, [radiusx.value0 !== undefined ? radiusx.value0 : undefined, radiusy.value0 !== undefined ? radiusy.value0 : undefined, radiusz.value0 !== undefined ? radiusz.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 28 | }; 29 | }; 30 | exports.planeImpl = function(p, width, height, detailX, detailY) { 31 | return function() { 32 | callP5(p, p.plane, [width.value0 !== undefined ? width.value0 : undefined, height.value0 !== undefined ? height.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 33 | }; 34 | }; 35 | exports.sphereImpl = function(p, radius, detailX, detailY) { 36 | return function() { 37 | callP5(p, p.sphere, [radius.value0 !== undefined ? radius.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 38 | }; 39 | }; 40 | exports.torusImpl = function(p, radius, tubeRadius, detailX, detailY) { 41 | return function() { 42 | callP5(p, p.torus, [radius.value0 !== undefined ? radius.value0 : undefined, tubeRadius.value0 !== undefined ? tubeRadius.value0 : undefined, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 43 | }; 44 | }; -------------------------------------------------------------------------------- /src/P5/Shape/ThreeDPrimitives.purs: -------------------------------------------------------------------------------- 1 | module P5.Shape.ThreeDPrimitives 2 | ( box 3 | , cone 4 | , cylinder 5 | , ellipsoid 6 | , plane 7 | , sphere 8 | , torus 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import boxImpl :: Fn6 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Effect Unit) 22 | foreign import coneImpl :: Fn6 P5 (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Maybe Boolean) (Effect Unit) 23 | foreign import cylinderImpl :: Fn7 P5 (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Maybe Boolean) (Maybe Boolean) (Effect Unit) 24 | foreign import ellipsoidImpl :: Fn6 P5 (Maybe Number) (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Effect Unit) 25 | foreign import planeImpl :: Fn5 P5 (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Effect Unit) 26 | foreign import sphereImpl :: Fn4 P5 (Maybe Number) (Maybe Int) (Maybe Int) (Effect Unit) 27 | foreign import torusImpl :: Fn5 P5 (Maybe Number) (Maybe Number) (Maybe Int) (Maybe Int) (Effect Unit) 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/box) 30 | box :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 31 | box p5 width height depth detailX detailY = runFn6 boxImpl p5 width height depth detailX detailY 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/cone) 34 | cone :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Maybe Boolean) -> (Effect Unit) 35 | cone p5 radius height detailX detailY cap = runFn6 coneImpl p5 radius height detailX detailY cap 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/cylinder) 38 | cylinder :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Maybe Boolean) -> (Maybe Boolean) -> (Effect Unit) 39 | cylinder p5 radius height detailX detailY bottomCap topCap = runFn7 cylinderImpl p5 radius height detailX detailY bottomCap topCap 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/ellipsoid) 42 | ellipsoid :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 43 | ellipsoid p5 radiusx radiusy radiusz detailX detailY = runFn6 ellipsoidImpl p5 radiusx radiusy radiusz detailX detailY 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/plane) 46 | plane :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 47 | plane p5 width height detailX detailY = runFn5 planeImpl p5 width height detailX detailY 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/sphere) 50 | sphere :: P5 -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 51 | sphere p5 radius detailX detailY = runFn4 sphereImpl p5 radius detailX detailY 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/torus) 54 | torus :: P5 -> (Maybe Number) -> (Maybe Number) -> (Maybe Int) -> (Maybe Int) -> (Effect Unit) 55 | torus p5 radius tubeRadius detailX detailY = runFn5 torusImpl p5 radius tubeRadius detailX detailY 56 | -------------------------------------------------------------------------------- /src/P5/Shape/TwoDPrimitives.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.arcImpl = function(p, x, y, w, h, start, stop, mode, detail) { 11 | return function() { 12 | callP5(p, p.arc, [x, y, w, h, start, stop, mode.value0 !== undefined ? mode.value0 : undefined, detail.value0 !== undefined ? detail.value0 : undefined]); 13 | }; 14 | }; 15 | exports.ellipseImpl = function(p, x, y, w, h) { 16 | return function() { 17 | callP5(p, p.ellipse, [x, y, w, h.value0 !== undefined ? h.value0 : undefined]); 18 | }; 19 | }; 20 | exports.ellipse2Impl = function(p, x, y, w, h, detail) { 21 | return function() { 22 | callP5(p, p.ellipse, [x, y, w, h, detail]); 23 | }; 24 | }; 25 | exports.lineImpl = function(p, x1, y1, x2, y2) { 26 | return function() { 27 | callP5(p, p.line, [x1, y1, x2, y2]); 28 | }; 29 | }; 30 | exports.line2Impl = function(p, x1, y1, z1, x2, y2, z2) { 31 | return function() { 32 | callP5(p, p.line, [x1, y1, z1, x2, y2, z2]); 33 | }; 34 | }; 35 | exports.pointImpl = function(p, x, y, z) { 36 | return function() { 37 | callP5(p, p.point, [x, y, z.value0 !== undefined ? z.value0 : undefined]); 38 | }; 39 | }; 40 | exports.quadImpl = function(p, x1, y1, x2, y2, x3, y3, x4, y4) { 41 | return function() { 42 | callP5(p, p.quad, [x1, y1, x2, y2, x3, y3, x4, y4]); 43 | }; 44 | }; 45 | exports.rectImpl = function(p, x, y, w, h, detailX, detailY) { 46 | return function() { 47 | callP5(p, p.rect, [x, y, w, h, detailX.value0 !== undefined ? detailX.value0 : undefined, detailY.value0 !== undefined ? detailY.value0 : undefined]); 48 | }; 49 | }; 50 | exports.rect2Impl = function(p, x, y, w, h, tl, tr, br, bl) { 51 | return function() { 52 | callP5(p, p.rect, [x, y, w, h, tl.value0 !== undefined ? tl.value0 : undefined, tr.value0 !== undefined ? tr.value0 : undefined, br.value0 !== undefined ? br.value0 : undefined, bl.value0 !== undefined ? bl.value0 : undefined]); 53 | }; 54 | }; 55 | exports.triangleImpl = function(p, x1, y1, x2, y2, x3, y3) { 56 | return function() { 57 | callP5(p, p.triangle, [x1, y1, x2, y2, x3, y3]); 58 | }; 59 | }; -------------------------------------------------------------------------------- /src/P5/Shape/Vertex.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.beginContourImpl = function(p) { 11 | return function() { 12 | callP5(p, p.beginContour, []); 13 | }; 14 | }; 15 | exports.beginShapeImpl = function(p, kind) { 16 | return function() { 17 | callP5(p, p.beginShape, [kind.value0 !== undefined ? kind.value0 : undefined]); 18 | }; 19 | }; 20 | exports.bezierVertexImpl = function(p, x2, y2, x3, y3, x4, y4) { 21 | return function() { 22 | callP5(p, p.bezierVertex, [x2, y2, x3, y3, x4, y4]); 23 | }; 24 | }; 25 | exports.bezierVertex2Impl = function(p, x2, y2, z2, x3, y3, z3, x4, y4, z4) { 26 | return function() { 27 | callP5(p, p.bezierVertex, [x2, y2, z2, x3, y3, z3, x4, y4, z4]); 28 | }; 29 | }; 30 | exports.curveVertexImpl = function(p, x, y) { 31 | return function() { 32 | callP5(p, p.curveVertex, [x, y]); 33 | }; 34 | }; 35 | exports.curveVertex2Impl = function(p, x, y, z) { 36 | return function() { 37 | callP5(p, p.curveVertex, [x, y, z.value0 !== undefined ? z.value0 : undefined]); 38 | }; 39 | }; 40 | exports.endContourImpl = function(p) { 41 | return function() { 42 | callP5(p, p.endContour, []); 43 | }; 44 | }; 45 | exports.endShapeImpl = function(p, mode) { 46 | return function() { 47 | callP5(p, p.endShape, [mode.value0 !== undefined ? mode.value0 : undefined]); 48 | }; 49 | }; 50 | exports.quadraticVertexImpl = function(p, cx, cy, x3, y3) { 51 | return function() { 52 | callP5(p, p.quadraticVertex, [cx, cy, x3, y3]); 53 | }; 54 | }; 55 | exports.quadraticVertex2Impl = function(p, cx, cy, cz, x3, y3, z3) { 56 | return function() { 57 | callP5(p, p.quadraticVertex, [cx, cy, cz, x3, y3, z3]); 58 | }; 59 | }; 60 | exports.vertexImpl = function(p, x, y) { 61 | return function() { 62 | callP5(p, p.vertex, [x, y]); 63 | }; 64 | }; 65 | exports.vertex2Impl = function(p, x, y, z, u, v) { 66 | return function() { 67 | callP5(p, p.vertex, [x, y, z, u.value0 !== undefined ? u.value0 : undefined, v.value0 !== undefined ? v.value0 : undefined]); 68 | }; 69 | }; -------------------------------------------------------------------------------- /src/P5/Structure.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.loopImpl = function(p) { 11 | return function() { 12 | callP5(p, p.loop, []); 13 | }; 14 | }; 15 | exports.noLoopImpl = function(p) { 16 | return function() { 17 | callP5(p, p.noLoop, []); 18 | }; 19 | }; 20 | exports.popImpl = function(p) { 21 | return function() { 22 | callP5(p, p.pop, []); 23 | }; 24 | }; 25 | exports.preloadImpl = function(p) { 26 | return function() { 27 | callP5(p, p.preload, []); 28 | }; 29 | }; 30 | exports.pushImpl = function(p) { 31 | return function() { 32 | callP5(p, p.push, []); 33 | }; 34 | }; 35 | exports.redrawImpl = function(p, n) { 36 | return function() { 37 | callP5(p, p.redraw, [n.value0 !== undefined ? n.value0 : undefined]); 38 | }; 39 | }; 40 | exports.removeImpl = function(p) { 41 | return function() { 42 | callP5(p, p.remove, []); 43 | }; 44 | }; -------------------------------------------------------------------------------- /src/P5/Structure.purs: -------------------------------------------------------------------------------- 1 | module P5.Structure 2 | ( loop 3 | , noLoop 4 | , pop 5 | , preload 6 | , push 7 | , redraw 8 | , remove 9 | ) where 10 | 11 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 12 | import Effect (Effect) 13 | import Prelude (Unit) 14 | import P5.Types 15 | import Foreign (Foreign, unsafeToForeign) 16 | import Data.Maybe (Maybe, maybe) 17 | import Foreign.NullOrUndefined (undefined) 18 | 19 | 20 | 21 | foreign import loopImpl :: Fn1 P5 (Effect Unit) 22 | foreign import noLoopImpl :: Fn1 P5 (Effect Unit) 23 | foreign import popImpl :: Fn1 P5 (Effect Unit) 24 | foreign import preloadImpl :: Fn1 P5 (Effect Unit) 25 | foreign import pushImpl :: Fn1 P5 (Effect Unit) 26 | foreign import redrawImpl :: Fn2 P5 (Maybe Int) (Effect Unit) 27 | foreign import removeImpl :: Fn1 P5 (Effect Unit) 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/loop) 30 | loop :: P5 -> (Effect Unit) 31 | loop p5 = runFn1 loopImpl p5 32 | 33 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/noLoop) 34 | noLoop :: P5 -> (Effect Unit) 35 | noLoop p5 = runFn1 noLoopImpl p5 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/pop) 38 | pop :: P5 -> (Effect Unit) 39 | pop p5 = runFn1 popImpl p5 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/preload) 42 | preload :: P5 -> (Effect Unit) 43 | preload p5 = runFn1 preloadImpl p5 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/push) 46 | push :: P5 -> (Effect Unit) 47 | push p5 = runFn1 pushImpl p5 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/redraw) 50 | redraw :: P5 -> (Maybe Int) -> (Effect Unit) 51 | redraw p5 n = runFn2 redrawImpl p5 n 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/remove) 54 | remove :: P5 -> (Effect Unit) 55 | remove p5 = runFn1 removeImpl p5 56 | -------------------------------------------------------------------------------- /src/P5/Transform.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.applyMatrixImpl = function(p, a, b, c, d, e, f) { 11 | return function() { 12 | callP5(p, p.applyMatrix, [a, b, c, d, e, f]); 13 | }; 14 | }; 15 | exports.resetMatrixImpl = function(p) { 16 | return function() { 17 | callP5(p, p.resetMatrix, []); 18 | }; 19 | }; 20 | exports.rotateImpl = function(p, angle, axis) { 21 | return function() { 22 | callP5(p, p.rotate, [angle, axis.value0 !== undefined ? axis.value0.value0 : undefined]); 23 | }; 24 | }; 25 | exports.rotateXImpl = function(p, angle) { 26 | return function() { 27 | callP5(p, p.rotateX, [angle]); 28 | }; 29 | }; 30 | exports.rotateYImpl = function(p, angle) { 31 | return function() { 32 | callP5(p, p.rotateY, [angle]); 33 | }; 34 | }; 35 | exports.rotateZImpl = function(p, angle) { 36 | return function() { 37 | callP5(p, p.rotateZ, [angle]); 38 | }; 39 | }; 40 | exports.scaleImpl = function(p, scales) { 41 | return function() { 42 | callP5(p, p.scale, [scales.value0]); 43 | }; 44 | }; 45 | exports.scale2Impl = function(p, s, y, z) { 46 | return function() { 47 | callP5(p, p.scale, [s.value0, y.value0 !== undefined ? y.value0 : undefined, z.value0 !== undefined ? z.value0 : undefined]); 48 | }; 49 | }; 50 | exports.shearXImpl = function(p, angle) { 51 | return function() { 52 | callP5(p, p.shearX, [angle]); 53 | }; 54 | }; 55 | exports.shearYImpl = function(p, angle) { 56 | return function() { 57 | callP5(p, p.shearY, [angle]); 58 | }; 59 | }; 60 | exports.translateImpl = function(p, vector) { 61 | return function() { 62 | callP5(p, p.translate, [vector]); 63 | }; 64 | }; 65 | exports.translate2Impl = function(p, x, y, z) { 66 | return function() { 67 | callP5(p, p.translate, [x, y, z.value0 !== undefined ? z.value0 : undefined]); 68 | }; 69 | }; -------------------------------------------------------------------------------- /src/P5/Types/Color.js: -------------------------------------------------------------------------------- 1 | function callP5(p5, method, args) { 2 | return method.apply( 3 | p5, trimRightUndefined(args)); 4 | } 5 | function trimRightUndefined(array) { 6 | return array.filter(function (x, i) { 7 | return i < array.length - 1 || x !== undefined; 8 | }); 9 | } 10 | exports.setRedImpl = function(p5, color, red) { 11 | var newColor = p5.color(color.toString()); 12 | callP5(newColor, newColor.setRed, [red]); 13 | return newColor; 14 | }; 15 | exports.setGreenImpl = function(p5, color, green) { 16 | var newColor = p5.color(color.toString()); 17 | callP5(newColor, newColor.setGreen, [green]); 18 | return newColor; 19 | }; 20 | exports.setBlueImpl = function(p5, color, blue) { 21 | var newColor = p5.color(color.toString()); 22 | callP5(newColor, newColor.setBlue, [blue]); 23 | return newColor; 24 | }; 25 | exports.setAlphaImpl = function(p5, color, alpha) { 26 | var newColor = p5.color(color.toString()); 27 | callP5(newColor, newColor.setAlpha, [alpha]); 28 | return newColor; 29 | }; 30 | -------------------------------------------------------------------------------- /src/P5/Types/Color.purs: -------------------------------------------------------------------------------- 1 | module P5.Types.Color 2 | ( setRed 3 | , setGreen 4 | , setBlue 5 | , setAlpha 6 | ) where 7 | 8 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 9 | import Prelude (Unit) 10 | import P5.Types 11 | 12 | foreign import setRedImpl :: Fn3 P5 Color Number Color 13 | foreign import setGreenImpl :: Fn3 P5 Color Number Color 14 | foreign import setBlueImpl :: Fn3 P5 Color Number Color 15 | foreign import setAlphaImpl :: Fn3 P5 Color Number Color 16 | 17 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setRed) 18 | setRed :: P5 -> Color -> Number -> Color 19 | setRed p5 color red = runFn3 setRedImpl p5 color red 20 | 21 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setGreen) 22 | setGreen :: P5 -> Color -> Number -> Color 23 | setGreen p5 color green = runFn3 setGreenImpl p5 color green 24 | 25 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setBlue) 26 | setBlue :: P5 -> Color -> Number -> Color 27 | setBlue p5 color blue = runFn3 setBlueImpl p5 color blue 28 | 29 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Color/setAlpha) 30 | setAlpha :: P5 -> Color -> Number -> Color 31 | setAlpha p5 color alpha = runFn3 setAlphaImpl p5 color alpha 32 | -------------------------------------------------------------------------------- /src/P5/Types/Image.js: -------------------------------------------------------------------------------- 1 | exports.heightImpl = function(p5, image) { 2 | return image.height; 3 | }; 4 | exports.widthImpl = function(p5, image) { 5 | return image.width; 6 | }; 7 | -------------------------------------------------------------------------------- /src/P5/Types/Image.purs: -------------------------------------------------------------------------------- 1 | module P5.Types.Image 2 | ( height 3 | , width 4 | ) where 5 | 6 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 7 | import Prelude (Unit) 8 | import P5.Types 9 | 10 | foreign import heightImpl :: Fn2 P5 Image Number 11 | foreign import widthImpl :: Fn2 P5 Image Number 12 | 13 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Image/height) 14 | height :: P5 -> Image -> Number 15 | height p5 img = runFn2 heightImpl p5 img 16 | 17 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5.Image/width) 18 | width :: P5 -> Image -> Number 19 | width p5 img = runFn2 widthImpl p5 img 20 | -------------------------------------------------------------------------------- /src/P5/Typography.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.loadFontImpl = function(p, path, callback, onError) { 11 | return callP5(p, p.loadFont, [path, callback.value0 !== undefined ? callback.value0 : undefined, onError.value0 !== undefined ? onError.value0 : undefined]); 12 | }; 13 | exports.textAlign2Impl = function(p, horizAlign, vertAlign) { 14 | return function() { 15 | callP5(p, p.textAlign, [p[horizAlign.constructor.name.replace(new RegExp('^TEXT_ALIGN_HORIZ_ALIGN_'), '')], vertAlign.value0 !== undefined ? vertAlign.value0 : undefined]); 16 | }; 17 | }; 18 | exports.textAscentImpl = function(p) { 19 | return callP5(p, p.textAscent, []); 20 | }; 21 | exports.textDescentImpl = function(p) { 22 | return callP5(p, p.textDescent, []); 23 | }; 24 | exports.textLeadingImpl = function(p) { 25 | return callP5(p, p.textLeading, []); 26 | }; 27 | exports.textLeading2Impl = function(p, leading) { 28 | return function() { 29 | callP5(p, p.textLeading, [leading]); 30 | }; 31 | }; 32 | exports.textSizeImpl = function(p) { 33 | return callP5(p, p.textSize, []); 34 | }; 35 | exports.textSize2Impl = function(p, theSize) { 36 | return function() { 37 | callP5(p, p.textSize, [theSize]); 38 | }; 39 | }; 40 | exports.textStyleImpl = function(p) { 41 | return callP5(p, p.textStyle, []); 42 | }; 43 | exports.textStyle2Impl = function(p, theStyle) { 44 | return function() { 45 | callP5(p, p.textStyle, [p[theStyle.constructor.name.replace(new RegExp('^TEXT_STYLE_'), '')]]); 46 | }; 47 | }; 48 | exports.textWidthImpl = function(p, theText) { 49 | return callP5(p, p.textWidth, [theText]); 50 | }; -------------------------------------------------------------------------------- /src/P5/Typography.purs: -------------------------------------------------------------------------------- 1 | module P5.Typography 2 | ( module P5.Typography.LoadingAndDisplaying 3 | , module P5.Typography.Attributes 4 | ) where 5 | 6 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 7 | import Effect (Effect) 8 | import Prelude (Unit) 9 | import P5.Types 10 | import Foreign (Foreign, unsafeToForeign) 11 | import Data.Maybe (Maybe, maybe) 12 | import Foreign.NullOrUndefined (undefined) 13 | 14 | import P5.Typography.LoadingAndDisplaying 15 | import P5.Typography.Attributes 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/P5/Typography/Attributes.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.textAlign2Impl = function(p, horizAlign, vertAlign) { 11 | return function() { 12 | callP5(p, p.textAlign, [p[horizAlign.constructor.name.replace(new RegExp('^TEXT_ALIGN_HORIZ_ALIGN_'), '')], vertAlign.value0 !== undefined ? vertAlign.value0 : undefined]); 13 | }; 14 | }; 15 | exports.textAscentImpl = function(p) { 16 | return callP5(p, p.textAscent, []); 17 | }; 18 | exports.textDescentImpl = function(p) { 19 | return callP5(p, p.textDescent, []); 20 | }; 21 | exports.textLeadingImpl = function(p) { 22 | return callP5(p, p.textLeading, []); 23 | }; 24 | exports.textLeading2Impl = function(p, leading) { 25 | return function() { 26 | callP5(p, p.textLeading, [leading]); 27 | }; 28 | }; 29 | exports.textSizeImpl = function(p) { 30 | return callP5(p, p.textSize, []); 31 | }; 32 | exports.textSize2Impl = function(p, theSize) { 33 | return function() { 34 | callP5(p, p.textSize, [theSize]); 35 | }; 36 | }; 37 | exports.textStyleImpl = function(p) { 38 | return callP5(p, p.textStyle, []); 39 | }; 40 | exports.textStyle2Impl = function(p, theStyle) { 41 | return function() { 42 | callP5(p, p.textStyle, [p[theStyle.constructor.name.replace(new RegExp('^TEXT_STYLE_'), '')]]); 43 | }; 44 | }; 45 | exports.textWidthImpl = function(p, theText) { 46 | return callP5(p, p.textWidth, [theText]); 47 | }; -------------------------------------------------------------------------------- /src/P5/Typography/Attributes.purs: -------------------------------------------------------------------------------- 1 | module P5.Typography.Attributes 2 | ( textAlign2 3 | , textAscent 4 | , textDescent 5 | , textLeading 6 | , textLeading2 7 | , textSize 8 | , textSize2 9 | , textStyle 10 | , textStyle2 11 | , textWidth 12 | ) where 13 | 14 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 15 | import Effect (Effect) 16 | import Prelude (Unit) 17 | import P5.Types 18 | import Foreign (Foreign, unsafeToForeign) 19 | import Data.Maybe (Maybe, maybe) 20 | import Foreign.NullOrUndefined (undefined) 21 | 22 | 23 | 24 | foreign import textAlign2Impl :: Fn3 P5 TextAlignHorizAlign (Maybe TextAlignVertAlign) (Effect Unit) 25 | foreign import textAscentImpl :: Fn1 P5 Number 26 | foreign import textDescentImpl :: Fn1 P5 Number 27 | foreign import textLeadingImpl :: Fn1 P5 Number 28 | foreign import textLeading2Impl :: Fn2 P5 Number (Effect Unit) 29 | foreign import textSizeImpl :: Fn1 P5 Number 30 | foreign import textSize2Impl :: Fn2 P5 Number (Effect Unit) 31 | foreign import textStyleImpl :: Fn1 P5 String 32 | foreign import textStyle2Impl :: Fn2 P5 TextStyle (Effect Unit) 33 | foreign import textWidthImpl :: Fn2 P5 String Number 34 | 35 | -- TODO: unsupported: textAlign :: P5 -> Unsupported(Object) 36 | 37 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textAlign) 38 | textAlign2 :: P5 -> TextAlignHorizAlign -> (Maybe TextAlignVertAlign) -> (Effect Unit) 39 | textAlign2 p5 horizAlign vertAlign = runFn3 textAlign2Impl p5 horizAlign vertAlign 40 | 41 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textAscent) 42 | textAscent :: P5 -> Number 43 | textAscent p5 = runFn1 textAscentImpl p5 44 | 45 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textDescent) 46 | textDescent :: P5 -> Number 47 | textDescent p5 = runFn1 textDescentImpl p5 48 | 49 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 50 | textLeading :: P5 -> Number 51 | textLeading p5 = runFn1 textLeadingImpl p5 52 | 53 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textLeading) 54 | textLeading2 :: P5 -> Number -> (Effect Unit) 55 | textLeading2 p5 leading = runFn2 textLeading2Impl p5 leading 56 | 57 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 58 | textSize :: P5 -> Number 59 | textSize p5 = runFn1 textSizeImpl p5 60 | 61 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textSize) 62 | textSize2 :: P5 -> Number -> (Effect Unit) 63 | textSize2 p5 theSize = runFn2 textSize2Impl p5 theSize 64 | 65 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 66 | textStyle :: P5 -> String 67 | textStyle p5 = runFn1 textStyleImpl p5 68 | 69 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textStyle) 70 | textStyle2 :: P5 -> TextStyle -> (Effect Unit) 71 | textStyle2 p5 theStyle = runFn2 textStyle2Impl p5 theStyle 72 | 73 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/textWidth) 74 | textWidth :: P5 -> String -> Number 75 | textWidth p5 theText = runFn2 textWidthImpl p5 theText 76 | -------------------------------------------------------------------------------- /src/P5/Typography/LoadingAndDisplaying.js: -------------------------------------------------------------------------------- 1 | function trimRightUndefined(array) { 2 | return array.filter(function (x, i) { 3 | return i < array.length - 1 || x !== undefined; 4 | }); 5 | } 6 | function callP5(p5, method, args) { 7 | return method.apply( 8 | p5, trimRightUndefined(args)); 9 | } 10 | exports.loadFontImpl = function(p, path, callback, onError) { 11 | return callP5(p, p.loadFont, [path, callback.value0 !== undefined ? callback.value0 : undefined, onError.value0 !== undefined ? onError.value0 : undefined]); 12 | }; -------------------------------------------------------------------------------- /src/P5/Typography/LoadingAndDisplaying.purs: -------------------------------------------------------------------------------- 1 | module P5.Typography.LoadingAndDisplaying 2 | ( loadFont 3 | ) where 4 | 5 | import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9) 6 | import Effect (Effect) 7 | import Prelude (Unit) 8 | import P5.Types 9 | import Foreign (Foreign, unsafeToForeign) 10 | import Data.Maybe (Maybe, maybe) 11 | import Foreign.NullOrUndefined (undefined) 12 | 13 | 14 | 15 | foreign import loadFontImpl :: Fn4 P5 String (Maybe (Effect Unit)) (Maybe (Effect Unit)) Font 16 | 17 | -- | [p5js.org documentation](https://p5js.org/reference/#/p5/loadFont) 18 | loadFont :: P5 -> String -> (Maybe (Effect Unit)) -> (Maybe (Effect Unit)) -> Font 19 | loadFont p5 path callback onError = runFn4 loadFontImpl p5 path callback onError 20 | 21 | -- TODO: unsupported: text :: P5 -> UnsupportedProduct(UnsupportedProduct(UnsupportedProduct(UnsupportedProduct(Unsupported(Array)|Boolean)|Number)|Unsupported(Object))|String) -> Number -> Number -> (Maybe Number) -> (Maybe Number) -> (Effect Unit) 22 | 23 | -- TODO: unsupported: textFont :: P5 -> Unsupported(Object) 24 | 25 | -- TODO: unsupported: textFont2 :: P5 -> UnsupportedProduct(Unsupported(Object)|String) -> (Maybe Number) -> (Effect Unit) 26 | -------------------------------------------------------------------------------- /webpack-dll.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpack = require('webpack'); 3 | const glob = require('glob'); 4 | 5 | module.exports = { 6 | devtool: 'cheap-module-inline-source-map', 7 | 8 | devServer: { 9 | contentBase: '.', 10 | port: 4040, 11 | stats: 'errors-only' 12 | }, 13 | 14 | entry: { 15 | vendor: [ 16 | 'p5', 17 | ].concat( 18 | glob.sync( 19 | 'bower_components/purescript-*/src/**/*.{purs,js}' 20 | ).map(file => 21 | file.replace('bower_components/', '') 22 | ) 23 | ) 24 | }, 25 | 26 | node: { 27 | fs: 'empty' 28 | }, 29 | 30 | output: { 31 | path: __dirname, 32 | pathinfo: true, 33 | filename: '[name]-dll.js', 34 | library: '[name]_[hash]_dll' 35 | }, 36 | 37 | module: { 38 | rules: [ 39 | { 40 | test: /\.purs$/, 41 | use: [ 42 | { 43 | loader: 'purs-loader', 44 | options: { 45 | src: [ 46 | 'bower_components/purescript-*/src/**/*.purs' 47 | ], 48 | bundle: false, 49 | psc: 'psa', 50 | watch: false, 51 | pscIde: false 52 | } 53 | } 54 | ] 55 | }, 56 | ] 57 | }, 58 | 59 | resolve: { 60 | modules: [ 'node_modules', 'bower_components' ], 61 | extensions: [ '.purs', '.js'] 62 | }, 63 | 64 | plugins: [ 65 | new webpack.LoaderOptionsPlugin({ 66 | debug: true 67 | }), 68 | new webpack.DllPlugin({ 69 | path: path.join(__dirname, '[name]-manifest.json'), 70 | name: '[name]_[hash]_dll' 71 | }) 72 | ] 73 | }; 74 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs'); 3 | const webpack = require('webpack'); 4 | const isWebpackDevServer = process.argv.some(a => path.basename(a) === 'webpack-dev-server'); 5 | const isWatch = process.argv.some(a => a === '--watch'); 6 | 7 | const plugins = 8 | isWebpackDevServer || !isWatch ? [] : [ 9 | function(){ 10 | this.plugin('done', function(stats){ 11 | process.stderr.write(stats.toString('errors-only')); 12 | }); 13 | } 14 | ] 15 | ; 16 | 17 | const devServerPort = 4008; 18 | 19 | module.exports = { 20 | devtool: 'cheap-module-inline-source-map', 21 | 22 | devServer: { 23 | contentBase: '.', 24 | port: devServerPort, 25 | stats: 'errors-only', 26 | hot: true, 27 | hotOnly: true 28 | }, 29 | 30 | entry: fs.readdirSync('./examples').reduce((acc, curr) => { 31 | acc[curr] = `./examples/${curr}/index.js`; 32 | return acc; 33 | }, {}), 34 | 35 | output: { 36 | path: path.resolve(__dirname, 'dist'), 37 | pathinfo: true, 38 | filename: '[name].js', 39 | publicPath: `http://localhost:${devServerPort}/`, 40 | }, 41 | 42 | module: { 43 | rules: [ 44 | { 45 | test: /\.purs$/, 46 | use: [ 47 | { 48 | loader: 'purs-loader', 49 | options: { 50 | src: [ 51 | 'bower_components/purescript-*/src/**/*.purs', 52 | 'src/**/*.purs', 53 | 'examples/**/*.purs', 54 | ], 55 | bundle: false, 56 | psc: 'psa', 57 | watch: isWebpackDevServer || isWatch, 58 | pscIde: true 59 | } 60 | } 61 | ] 62 | }, 63 | ] 64 | }, 65 | 66 | resolve: { 67 | modules: [ 'node_modules', 'bower_components' ], 68 | extensions: [ '.purs', '.js'] 69 | }, 70 | 71 | plugins: [ 72 | new webpack.LoaderOptionsPlugin({ 73 | debug: true 74 | }), 75 | new webpack.DllReferencePlugin({ 76 | context: __dirname, 77 | manifest: require('./vendor-manifest.json') 78 | }), 79 | new webpack.HotModuleReplacementPlugin() 80 | ].concat(plugins) 81 | }; 82 | --------------------------------------------------------------------------------