How to flip an image horizontaly or vertically using easel.js
Looking at Easel.js docs, you might think that Flip() function is missing. However, flipping is done using scale with negative values. To flip image horizontally, use:
image.scaleX = -1;
To flip vertically, use:
image.scaleY = -1;
Before flipping, make sure you set the regX and/or regY to the center of image. Full example with image sized 120x50:
var myimg = new createjs.Bitmap("sword.png"); myimg.regX = 60; myimg.regY = 25; myimg.scaleX = -1; // flip horizontally myimg.scaleY = -1; // flip verticallyTweet to @mbabuskov Tweet Milan Babuškov, 2013-05-08