Giter Club home page Giter Club logo

Comments (3)

jonobr1 avatar jonobr1 commented on May 23, 2024

I'm not familiar with Woscope, but you can always get the canvas element through the domElement property of Two.js's renderers like so:

const two = new Two({ type: Two.Types.webgl }):
const canvas = two.renderer.domElement;

Since, Woscope is using a canvas, you need to set the appropriate type. Alternatively, like Woscope, you could make a <canvas /> element and pass it in to Two.js like so:

const canvas = document.getElementById('my-canvas');
const two = new Two({
  type: Two.Types.webgl,
  domElement: canvas
});

from two.js.

joex92 avatar joex92 commented on May 23, 2024

ok, but would I be able to add things managed by Two.js to the canvas? for example, add a frame to the osciloscope and change its size?

from two.js.

jonobr1 avatar jonobr1 commented on May 23, 2024

I don't know how Woscope works, so I can't give you an answer to that. If you want to keep Woscope's content and Two.js content, then you'll want to enable overdraw: https://two.js.org/docs/renderers/webgl/#overdraw

Like so:

const two = new Two({
  type: Two.Types.webgl,
  overdraw: true
});

This will disable Two.js from clearing all content on the canvas every frame before it starts its own rendering.

from two.js.

Related Issues (20)

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.