Skip to content

Collection of different tips, tricks, tools and other usefull stuff for KineticJS.

License

Notifications You must be signed in to change notification settings

wwwwwwzj/kineticjs-tips-and-tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KineticJS tips and tools

KineticJS is an HTML5 Canvas JavaScript framework that enables high performance animations, transitions, node nesting, layering, filtering, caching, event handling for desktop and mobile applications, and much more.

This is collection of any usefull KineticJS stuff. Please fork and make pull request or create issue if you have something interesting!

Let's go!

Content:

So many information you can find on site: http://kineticjs.com/

Applications:

Plugins:

for work with other libs and frameworks:

Performance:

First, look at tutorial section on site:

  • Layers
  • BatchDraw
  • Caching
  • Setting transformsEnabled = 'position' on shape
  • Setting hitGraphEnabled = false on layer (if you don't need pointer events)
  • Avoid to use shadows and strokes

Also this stackoverflow posts can be useful:

// TODO : rewrite tips from answers to this file

Mobile tips:

  • Try to set viewport:
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  • If you have bad performance on retina display you can try to change pixelRation:
Kinetic.pixelRatio = 1

Possible problems:

Ghost shapes

Sometimes android device may have ghost shape on canvas. This is android bug. You can fix it by drawing layer with small (50ms) timeout. See for details: ericdrowell/KineticJS#481 (comment)

Please follow this article.

var stage = new Kinetic.Stage(conf);
var layer = new Kinetic.Layer();

stage.add(layer);

setTimeout(function(){
    // add shapes to the layer and then do layer.draw()
}, 50);

Some android devices have problems if parents of canvas have overflow:hidden. This snippet may be helpful:

if (navigator.userAgent.match(/Android/i)) {
    $("canvas").parents("*").css("overflow", "visible");
}

You can find more related information here: https://code.google.com/p/android/issues/detail?id=35474

Caching

Currently (v5.1.0) KineticJS has problems with cache if node has some transformation (rotate, scale, offset), so if you have any problems with caching try:

  1. Reset transform
  2. Cache node
  3. Apply transform again

Articles:

// TODO: check is it useful and talking about current version // TODO: add descriptions

Other:

About

Collection of different tips, tricks, tools and other usefull stuff for KineticJS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%