Git Product home page Git Product logo

p5js-screenposition's People

Contributors

bohnacker avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

p5js-screenposition's Issues

giving different results with the same vector values.

i have used your code of getting the screenX and y positions but instead of giving me the same result for the same X,Y,Z ?
the way i implemented the code is i used only the addScreenPositionFunction function
so what seems to be the issue ?thanks

Correspondence of x,y co-ordinate of 3D cube into x,y co -ordinate in 2D canvas ?

Hello , thanks for this library implementation. I had a doubt on the implementation with regards to finding corresponding co-ordinates in the 2D canvas. In the sketch below , I have used p5js screen position as suggested. The idea is to have a new cube appear when the x, y position of the mouse is inside the cube. (that is within the x,y co -ordinate of the cube) . However , i am not able to achieve that , I also reset the center position to (0,0,0) for a new co-ordinate system . I am wondering if you give me some pointers on this . The link to the sketch is here Sketch

Add Documentation on p5.Graphics?

From what I've found using the addScreenPositionFunction() on a p5.Graphics object works fine. But I don't know if this is universal. Anyways here's an example sketch if you think it's worth adding to the documentation.

let graphics;

function setup() {
  createCanvas(400, 400);
  graphics = createGraphics(width, height, WEBGL);
  addScreenPositionFunction(graphics);
  
  rectMode(CENTER)
  graphics.rectMode(CENTER);
}

function draw() {
  background(220);
  
  graphics.clear();
  graphics.rotateX(0.010);
  graphics.rotateY(0.011);
  graphics.rotateZ(0.012);
  graphics.square(0, 0, 200);
  image(graphics, 0, 0);
  
  push();
  translate(width/2, height/2);
  const gPoint = graphics.screenPosition(100, 0, 0);
  fill(0, 0, 255);
  square(gPoint.x, gPoint.y, 20);
  pop();
}

By the way thanks for making this library it's been super useful!

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.