Giter Club home page Giter Club logo

creative-code-toolkit-fp's Introduction

Creative Code Toolkit (FP)

This library is my personal collection of helper functions in creative coding, revolving around modulation, array functions, random numbers, etc.

Functions

mapRange :: Vector -> Vector -> Number -> Number

mapRange :: toRange -> tromRange -> value -> Number Map v in fromRange to fromRange

sinMap :: Vector -> Number -> Number

sinMap :: toRange -> Divisor -> Number Map the output sin(v / div) to toRange

cosMap :: Vector -> Number -> Number

cosMap :: toRange -> Divisor -> Number Map the output cos(v / div) to toRange

wrapValue :: Number -> Number -> Number -> Number

if v is greater than M or less than m, wrap the value around to stay in this range

deepArrayCopy :: [a] -> [a]

Return a deep copy array a

genArray :: Number -> []

Create an array of size s

get1dY :: Number -> Number -> Number

get1dY :: Columns -> Index -> Number Get the Y component of a 1d array containing 2d data when the index is i

get1dX :: Number -> Number -> Number

get1dX :: Columns -> Index -> Number Get the X component of a 1d array containing 2d data when the index is i

choose :: [a] -> a

pick a random element from the array a

without :: (*) -> [*] -> [*]

get an array without a specific member

chooseWithout :: a -> [a] -> [a]

compose(choose, without)

rndB :: Vector -> Number

rndB :: Range -> Number Random number in range

rndIntB :: Vector -> Number

rndIntB :: Range -> Number Random integer in range

polute()

Polutes the global scope with unnamespaced functions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.