mirror of https://github.com/perkeep/perkeep.git
Hardware accelerate the piggy.
This improves the performance of the piggy animation by doing it in hardware and eliminating a layout pass on every frame. Change-Id: I02cf8b521af60af0e61f70c7f732f97074bdcdc1
This commit is contained in:
parent
2d8c5992bf
commit
95f95a2623
|
@ -34,10 +34,8 @@ cam.SpritedImage = React.createClass({
|
||||||
if (y >= this.props.sheetHeight) {
|
if (y >= this.props.sheetHeight) {
|
||||||
throw new Error(goog.string.subs('Index %s out of range', this.props.index));
|
throw new Error(goog.string.subs('Index %s out of range', this.props.index));
|
||||||
}
|
}
|
||||||
return {
|
var style = {};
|
||||||
position: 'absolute',
|
style[cam.reactUtil.getVendorProp('transform')] = goog.string.subs('translate3d(%spx, %spx, 0)', -x * this.props.spriteWidth, -y * this.props.spriteHeight);
|
||||||
left: -x * this.props.spriteWidth,
|
return style;
|
||||||
top: -y * this.props.spriteHeight
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue