Giter VIP home page Giter VIP logo

hydra-p5's Introduction

hydra-p5

A simpler P5 intergration for Hydra

Usage

await loadScript("https://unpkg.com/hydra-p5")

p5src(s0)
  .setup((p) => {
    // this runs only once, but re-executes
    // when evaluating the whole block...
  })
  .draw((p) => {
    // this runs on every frame
    p.clear()
    p.rect(p.mouseX, p.mouseY, 300, 300)
  })
  // now you can keep using hydra like a normal source...
  .modulate(noise())
  .out()

There is an experimental drawP and setupP that allows you to use P5 in "global" mode inside their callback functions:

p5src(s0)
  .drawP(_ => {
    clear()
    rect(mouseX, mouseY, 300, 300)
  })
  .out()

Contributing

Bug reports and pull requests are welcome on GitHub at the issues page. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

This project is licensed under GPL 3+. Refer to LICENSE.txt

hydra-p5's People

Contributors

munshkr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hydra-p5's Issues

WEBGL mode does not work?

This works:

p = new P5({ mode: "WEBGL" })
p.hide()
s0.init({ src: p.canvas })

src(s0).out()

p.draw = () => {
    p.background(0);
    p.normalMaterial();
    p.push();
    p.rotateZ(p.frameCount * 0.01);
    p.rotateX(p.frameCount * 0.01);
    p.rotateY(p.frameCount * 0.01);
    p.box(70);
    p.pop();
}

but this doesnt:

p5src(s0, "WEBGL")
  .draw(p => {
    p.background(0);
    p.normalMaterial();
    p.push();
    p.rotateZ(p.frameCount * 0.01);
    p.rotateX(p.frameCount * 0.01);
    p.rotateY(p.frameCount * 0.01);
    p.box(70, 70, 70);
    p.pop();
  })
  .out()

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.