From 95f95a2623bbeb123fcfe7638c6e3fe460bc21c8 Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Wed, 15 Jan 2014 20:49:19 -0800 Subject: [PATCH] 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 --- server/camlistored/ui/sprited_image.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/camlistored/ui/sprited_image.js b/server/camlistored/ui/sprited_image.js index 3ee02a112..df5ac0a88 100644 --- a/server/camlistored/ui/sprited_image.js +++ b/server/camlistored/ui/sprited_image.js @@ -34,10 +34,8 @@ cam.SpritedImage = React.createClass({ if (y >= this.props.sheetHeight) { throw new Error(goog.string.subs('Index %s out of range', this.props.index)); } - return { - position: 'absolute', - left: -x * this.props.spriteWidth, - top: -y * this.props.spriteHeight - }; + var style = {}; + style[cam.reactUtil.getVendorProp('transform')] = goog.string.subs('translate3d(%spx, %spx, 0)', -x * this.props.spriteWidth, -y * this.props.spriteHeight); + return style; } });