Giter Club home page Giter Club logo

pt's People

Contributors

jacobmbr avatar synj24 avatar tofuness avatar williamngan 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pt's Issues

collideCircle2D?

I'm trying to collide particles with a circle, but there is no explicit method for that. I was thinking about making a new particle for the circle, but I'd have to override it's being a particle (no movement, mass, etc.).

How to destroy CanvasSpace?

For example, when I use Pt with React I should be able to destroy the Canvas Instance when the component leave.

trigger methods from other dom elements

This may already be achievable but I'm not quite sure how to do it so pardon if this is the wrong place for this. I am using this for a background effect very similar to the space.add demo. However I have some other dom elements positioned over the canvas which prevents the effect from occurring when the mouse passes over them.

I would like to make the onMouseAction work with a window even instead of just the canvas elements mouse event.

Hopefully that makes sense and sorry again if this is the wrong place for this.

npm scripts for development

Compiling pt currently requires a global installation of gulp. I think it can be worth introducing some npm scripts to avoid having to install gulp globally.

Example (package.json):

{
  name: "ptjs",
  ...
  "scripts": {
    "gulp:watch": "gulp" <-- uses the local gulp dependency
  }
}

Support for higher pixel density

Canvas drawings become blurry on screens with higher window.devicePixelRatio.

My current quick hack is just to use the css transform: scale. Not pretty ๐Ÿ˜ฅ

Multitouch Events?

So, we can have something like:

space.bindMultiTouch();

And a onTouchAction callback. But it needs to take in to consideration that there might be several touch events at any point.

CanvasSpace does not set its size

When initializing a CanvasSpace on a container that already contains a canvas, the size attribute of the CanvasSpace instance does not get updated with the canvas element's size, resulting in empty renderings. This case should be supported according to documentation ("an id property which refers to the "id" attribute of the canvas element in DOM. If no canvas element with this id is found, a new canvas element will be created."). I'd also see dropping this use case from the docs as a quicker solution.

Make it possible to pass DOM-object to CanvasSpace instead of id

In some cases, giving elements an id is undesirable. It would be better to just be able to pass in an object. For example with React, using IDs break the idea of writing reusable components.

Bad

var space = new CanvasSpace('canvas').setup( {bgcolor: '#f1f5f7'} )

render () {
  return (
    <canvas id="canvas" />
  )
}

Good

var space = new CanvasSpace(this.refs.canvas).setup( {bgcolor: '#f1f5f7'} )

render () {
  return (
    <canvas ref="canvas" />
  )
}

Add option to disable auto-resize (?)

  1. If you do a css transform: rotateX(30deg) on a canvas element, or any container containing a canvas element, the width/height values change.
  2. If you then resize the browser window the canvas size is updated with the new width/height.
  3. In my case, I wanted the actual canvas size to stay the same despite the rotation.

I fixed it by doing something like this:

window.addEventListener('resize', () => {
    space.resize(someCanvasWidth, someCanvasHeight);
});

directly after CanvasSpace performs its auto-resize.

I don't think my solution is good since it request two extra renders for every resize event. Maybe CanvasSpace should have an option so that resize has to be called manually?

on window resize

Please, help
How to make canvas fluid, or simply reinit when window resizing.
Applying to the demos - I want make something interesting on my website with them.

Create a CanvasSpace with transparent color

Is it possible to create a CanvasSpace with transparent background?

I'm currently using
new CanvasSpace('id').setup({ bgcolor: 'rgba(0,0,0,0.1)' });
with no luck

Thanks!

Text as intersectPath

Hello!

Not sure if this is the right place to ask, but I'm wondering if there is a way to use text as a mask in pt.js.

I'm trying to combine the font.js and the samplepoints demo so that the dots transform into the text.

schermafbeelding 2015-09-29 om 20 44 18

Awesome library by the way!

CanvasSpace bgcolor

CanvasSpace(id, bgcolor) parameter should set background color initially.

Currently it requires another space.clear() to set background color.

Clearer documentation and API for initializing CanvasSpace

I find the documentation for CanvasSpace to be unclear about how to initialize it and call its display() method. The CanvasSpace's id attribute is briefly explained as:
"an id property which refers to the "id" attribute of the canvas element in DOM. If no canvas element with this id is found, a new canvas element will be created."
While the display method's parent_id attribute is described as:
"the DOM element into which the canvas element should be appended".

So right now to select/obtain the canvas element you want to use for pt, you need to write something like CanvasSpace('canvasId').display('#canvasContainer'). I found it very easy to get confused and get it wrong, so I'm just suggesting to add one or two example usages there. And maybe highlight the fact that by default, with no parameters specified, it will simply append a new canvas element to a container with id "pt".

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.