easeljs

Easel.js: Browser compatibility when placing an image within a container and adding mouse interactions

别说谁变了你拦得住时间么 提交于 2019-12-24 16:12:55
问题 I'm going to start this question off by saying that this is 100% working in Firefox (v21.0). For some reason it's not working in Google Chrome (v27.0.1453.94m). It also doesn't work in IE10. Here is the JavaScript code I'm having issues with: function canvasDrawBackground(value){ console.log(value); stage.removeChild(background); var temp = new createjs.Bitmap("images/bg_" + value +".jpg"); background = new createjs.Container(); background.x = background.y = 0; background.addChild(temp);

duplicating objects with easeljs

对着背影说爱祢 提交于 2019-12-24 14:29:54
问题 I keep having problems trying to reuse elements using the easeljs library. Whether I use the clone() method, where I can only get one instance and then events like onPress will stop working for the new elements. Adding the same object on more than one container will make the object to disappear everywhere. I keep having to find workarounds around this, messing up my code and wasting resources. Thanks in advance for any help or tip. 回答1: if you are using Shape's Graphics , you might want to

How to draw a full coordinate system with Easeljs?

白昼怎懂夜的黑 提交于 2019-12-24 06:42:59
问题 I would like to create a complete coordinate system by drawing it on the canvas. It should look similar to this: My question is, what is the code to create this image with Easeljs? Please ignore the headline "Koordinatensystem" and the red cross in the center. I did this once in flash but used the line tool, arrow tool, label tool, etc. Now porting everything to HTML5 and trying to create everything only using code :) 回答1: Well, I do not know if this can be called optimized code, but it is

canvas cross domain pixel error

雨燕双飞 提交于 2019-12-24 02:42:16
问题 I'm having this issue with the html5 canvas. I'm using EaselJS to load in images. http://www.createjs.com/Docs/EaselJS/Bitmap.html But when I add any kind of mouse events (onClick, onMouseOver, onMouseOut) on a parentcontainer of the image, from the moment i move my mouse, EaselJS spams this error: uncaught exception: An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images. It's running on an IIS server and the

Dynamic Stage name in EaselJS

只愿长相守 提交于 2019-12-24 01:26:17
问题 I'm currently working on a site designed to display multiple canvases at the same time, without knowing which canvases it's going to display in advance (a PHP script creates the list). The idea is to have multiple script files (one per canvas) be read by (typically) a single handler which will populate the individual stages. stage = new createjs.Stage(context); I'm stuck here. At the time I create a given stage, I know the name of the canvas I want to attach it to (for instance, stageA) and

Cache SpriteSheets in EaselJS

人走茶凉 提交于 2019-12-24 00:45:27
问题 How can I cache SpriteSheets in EaselJS? I have a Sprite object and when I use user.hero.cache(0, 0, 30, 40); it stops playing animation (probably because I'm just caching the current frame, not the entire SpriteSheet image). So how can I cache it? Here's my relevant EaselJS code: data = { images: ["Graphics/hero.png"], frames: { width: 30, height: 40 }, animations: { stand: 0, run: [1, 2, "runLoop", 0.15], runLoop: [3, 7, true, 0.15], jump: [8, 10, "happy", 0.5], happy: 11, fall: 12,

EaselJS BitmapAnimation.gotoAndPlay lag

无人久伴 提交于 2019-12-23 05:12:17
问题 I've written a requirejs module to take a BitmapAnimation and add methods to allow it to move around on the stage at a certain speed and once its destination has been reached, to move to another looped animation. The problem I'm having is that there is quite a lot of lag between gotoAndPlay being called and anything happening on stage. I've console.logged the methods that call gotoAndPlay but the logs happen immediately where the animation doesn't change as quickly. here is my abstract object

Targetting multiple Stages' children by name in EaselJS

人盡茶涼 提交于 2019-12-23 04:27:15
问题 (Continuation of this question.) So let's assume I have two stages and I want to update them simultaneously at a tick. $( document ).ready(function() { context = "First"; init(); context = "Second"; init(); createjs.Ticker.addEventListener("tick", tick); createjs.Ticker.setFPS(12); }); stages = [ "First", "Second" ] canvases = { "First": [ {"content": "small1.png"} ], "Second": [ {"content": "small2.png"} ] }; objects = []; function init() { window[context] = new createjs.Stage(context);

EaselJS: connect 2 containers/shapes using a line

我是研究僧i 提交于 2019-12-22 00:17:43
问题 I want to be able to click on a container/shape and as I move the mouse a line that can be connected to another container/shape (with an arrow at one end) is drawn. Ideally I want this line to snap to the destination element. I'm new to EaselJS and I've got no clue on how to go about this. This is the closes I've come across of here, and I can't make sense out of it: Drawing a Line in a html5 canvas using EaselJS 回答1: Here is a quick demo I put together The key steps are: Listen for mousedown

EaselJS - dragging children of scaled parent

依然范特西╮ 提交于 2019-12-21 20:44:13
问题 NOTE: ** This is now resolved. See the 'FIX' in my answer below. Feel free to inject any further knowledge as you see fit. First, I have been studying and googling the localToGlobal, localToLocal, and globalToLocal, but I am just not understanding these methods enough to accomplish what I am trying to achieve - a drag of items in a scaled parent. I have a container which contains some graphical nodes. The container's scaleX and scaleY are at 0.5 (or any other arbitrary number). When dragging