Code Monkey home page Code Monkey logo

sketch.js's People

Contributors

amilajack avatar ddsol avatar dmnsgn avatar filr avatar isaksky avatar jasonstorey avatar jsteunou avatar mazulo avatar nitriques avatar olexpono avatar saschageyer avatar soulwire 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  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

sketch.js's Issues

size of canvas

i'm a beginner . i'm not able to follow your documentation
can you tell me how to vary the size of canvas?

Change Default Clear Method to ctx.clearRect()

This might be a personal preference issue, or you might have performance reasons for using ctx.canvas.width = ctx.canvas.width for clearing - Code Reference.

However, I always find myself resetting the clear method to ctx.clearRect( 0, 0, ctx.canvas.width, ctx.canvas.height ) since that does not clear the state of the canvas. There are many simple animations I make that have initial line widths, stroke styles, or other default options that never get changed throughout the animation. It is nice not to have to redeclare those values on each loop tick.

Just something to consider, if you have other reasons for using the width clear method though, please let me know. Thanks!

Support for Paths

Sketch looks like an ideal fast Canvas / WebGL solution but I'm just wondering how it might be possible to use SVG paths within Sketch?

What I mean by path is just a string as defined by SVG. My app uses SVG data paths to define its symbols. The symbol paths are then listed in a JSON file and deserialized into a JavaScript cache object. I would take care of this bit of code. This minimal pre-canvas usage of SVG is the only aspect of SVG my app is concerned with.

From here on the focus is on the canvas and I'm not sure if there is some facility in Sketch to take such a cached path and render it to the view? Here is how a path could be used:

path = new Path('M 100,100 h 50 v 50 h 50');

As another option the JSON file of symbol paths could also be converted into a structure that Sketch uses? As long as there is some way to then clone that structure and raster it to screen it would work. Also not sure if Sketch maintains any type of scenegraph of objects, which might make hit detection easier?

Specify Existing Canvas on Creation

There are certain times when I am either forced or choose to use an existing canvas element. I'd love to use Sketch.js in these situations. If there was an option on creation to specify an existing canvas, that would rule. Something like:

Sketch.create({
    element: document.getElementById('existing-canvas')
});

Default size for canvas

Hey Justin,

When I set fullscreen to false the canvas gets created with 0 width and height. Could I be missing something obvious here about how to set it?

Regulate Large Delta Times Caused by Blur/Focus Events

When autopause is enabled and blur/focus events are starting and stopping the animation., the delta time (ctx.dt) can get incredibly large. It is of course obvious why this is happening, since tons of time is still passing, even while the animation isn't running. I am not sure of the best way to handle this.

I suppose you could store the current time when the blur occurs, and then get the current time when the focus occurs, and remove that amount from the delta calculation once things start up again. Any other ideas?

On a similar note, maybe you could just add blur/focus into the overridable instance methods, and we can handle regulating delta and other blur/focus issues manually, if that is out of the scope of sketch.js

[enhancement] Add missing bower.json.

Hey, maintainer(s) of soulwire/sketch.js!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library soulwire/sketch.js is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "soulwire/sketch.js",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Math functions should be in the Sketch namespace (object)

It is not a best pratice to pollute the window object with utility functions.

Let say I must support both your librairy and a other, older one, that re-creates the window.random property. Eveythings breaks down.

Another thing is if you use a linter (like jshint) it will warn you that method x is not declared. This is annoying.

Thanks.

Make Sure Setup Runs Before Resize

I recently ran into an issue where I was updating an array on resize that was attached to the main sketch object on setup. However, a resize event seems to always fire at least once before setup has occurred, so the array does not exist yet and throws an error. Is there any way to ensure that setup has run before running the resize function?

A reduced test case shows the errors via console: http://codepen.io/jackrugile/pen/5e60581d85a74dd996f8ddb9f53754d2

Add mouse position to touches array

This will allow for transparent multitouch handling even on non-multitouch platforms. For example, a mousemove handler could respond to all touches by default and on non-multitouch devices this would just parse the 0th element, being the mouse.

Add Missing Math Functions

Found myself using these the other day and they weren't available conveniently like the others:

abs
acos
asin
log

Chaining

I just wanted to add an enhancement request. If you could allow the chaining of canvas functions, that would be awesome :)

Check out LeaVerou's chainvas for inspiration.

Add UMD support

Add both AMD & CommonJS support. Again, from kkxlkkxllb PR #53 but with UMD, not just module.exports

Open up event binding for other elements

Refactor the bindEvents method to act more as a mixin for any object. This will get called on the context by default, but could also be used with any DOM element to handle mouse events, dragging (etc).

Fix support for DOM type.

It's probably me, and I can probably fix it.

There's mention of a Sketch.DOM type, but the variable isn't set, and relying on the default type case throws width/height and binding errors.

Pause run loop on focus lost

Could you add to Sketch.js the ability to automatically pause/resume the run loop on focus lost/gained?
It's useful when editing code with the sketch left open/viewable in the browser.

setup: function() {
        window.addEventListener("focus", function(e) { demo.start(); }, false);
        window.addEventListener("blur", function(e) { demo.stop(); }, false);
},

Focus event

Hi!

Your focus handling is nice, but it would be nice if we could turn this off. I am getting a real performance problem with this right now. Thanks.

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.