Skip to content
This repository was archived by the owner on Mar 10, 2019. It is now read-only.

Commit 46c4658

Browse files
committed
always try to activate hardware acceleration in css animations
1 parent c2090b7 commit 46c4658

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

LPViewAnimation.j

+5-4
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ var appendCSSValueToKey = function(/*DOMElement*/ anElement, /*CPString*/aValue,
144144
// Prepare target for this specific animation.
145145
[self target:target addCSSAnimationPropertyForKey:kind append:x !== 0];
146146

147-
// Oddly enough, this does not need to be wrapped in a setTimeout.
147+
// Needs to be wrapped.
148148
setTimeout(function(_target, _end){
149+
_target._DOMElement.style["-webkit-transform"] = "translate3d(0px, 0px, 0px)";
149150
[_target setAlphaValue:_end];
150151
}, 0, target, end);
151152

@@ -165,7 +166,7 @@ var appendCSSValueToKey = function(/*DOMElement*/ anElement, /*CPString*/aValue,
165166
var x = _end.x - _start.x,
166167
y = _end.y - _start.y;
167168

168-
_target._DOMElement.style["-webkit-transform"] = "translate(" + x +"px, " + y + "px)";
169+
_target._DOMElement.style["-webkit-transform"] = "translate3d(" + x +"px, " + y + "px, 0px)";
169170

170171
// Need to match the new position with the actual frame
171172
setTimeout(function(){
@@ -174,7 +175,7 @@ var appendCSSValueToKey = function(/*DOMElement*/ anElement, /*CPString*/aValue,
174175
[self _clearCSS];
175176

176177
// Reset the translate
177-
_target._DOMElement.style["-webkit-transform"] = "translate(0px, 0px)";
178+
_target._DOMElement.style["-webkit-transform"] = "translate3d(0px, 0px, 0px)";
178179

179180
// Set the real frame
180181
[_target setFrameOrigin:_end];
@@ -350,7 +351,7 @@ var appendCSSValueToKey = function(/*DOMElement*/ anElement, /*CPString*/aValue,
350351

351352
switch(aKey)
352353
{
353-
case LPFadeAnimationKey: CSSValue = @"opacity";
354+
case LPFadeAnimationKey: CSSValue = @"-webkit-transform, opacity";
354355
break;
355356

356357
case LPOriginAnimationKey: CSSValue = @"-webkit-transform";

0 commit comments

Comments
 (0)