Fixed: The animation was reverting back to its initial position.

Although the fill-mode property was correctly set to forwards allowing
the final state to persist, the animation-name property was deleted too
early . It was causing the animation to be cancelled and the initial
state restored.
This commit is contained in:
cacaodev committed 2016-06-12 10:12:07 +02:00
1 parent d6dd0e551d
commit 86a8a9dc85
2 files changed
+19 -32

No files matched your search

+5 -14
View File
@@ -163,9 +163,13 @@ CPLog.debug(_cmd + "context stack =" + _CPAnimationContextStack);
{
if (needsFrameTimer)
[self stopFrameUpdaterWithIdentifier:objectId];
else if (animationCompletion)
if (animationCompletion)
animationCompletion();
if (needsFrameTimer || animationCompletion)
[[CPRunLoop currentRunLoop] performSelectors];
if (_completionHandlerAgent)
_completionHandlerAgent.decrement();
};
@@ -299,9 +303,6 @@ CPLog.debug(_cmd + "context stack =" + _CPAnimationContextStack);
cssAnimation.addPropertyAnimation(property, getter, duration, anAction.keytimes, anAction.values, timingFunctions, completionFunction);
}];
if (needsFrameTimer)
cssAnimation.setRemoveAnimationPropertyOnCompletion(false);
}
if (needsFrameTimer)
@@ -640,17 +641,7 @@ FrameUpdater.prototype.start = function()
FrameUpdater.prototype.stop = function()
{
CPLog.debug("stop FrameUpdater with id " + this.identifier());
this._stop = true;
var targets = this._targets;
for (var i = 0; i < targets.length; i++)
{
CPLog.debug(targets[i] + " Remove animation-name property");
targets[i]._DOMElement.style.removeProperty(CPBrowserCSSProperty("animation-name"));
}
};
FrameUpdater.prototype.updateFunction = function()
+14 -18
View File
@@ -51,7 +51,6 @@ CSSAnimation = function(aTarget/*DOM Element*/, anIdentifier)
this.animationsdurations = [];
this.islive = false;
this.didBuildDOMElements = false;
this.removeAnimationPropertyOnCompletion = true;
animation = this;
CURRENT_ANIMATIONS[anIdentifier] = animation;
@@ -177,21 +176,21 @@ CSSAnimation.prototype.endEventListener = function()
if (idx !== -1)
inFlightAnimationsNames.splice(idx, 1);
if (inFlightAnimationsNames.length == 0)
if (inFlightAnimationsNames.length > 0)
return;
for (var i = 0; i < animationsNames.length; i++)
{
for (var i = 0; i < animationsNames.length; i++)
{
var completion = animation.completionFunctionForAnimationName(animationsNames[i]);
if (completion)
completion();
}
var completion = animation.completionFunctionForAnimationName(animationsNames[i]);
if (completion)
completion();
}
var eventTarget = event.target,
style = eventTarget.style;
if (animation.removeAnimationPropertyOnCompletion)
style.removeProperty(ANIMATION_NAME_PROPERTY);
var eventTarget = event.target,
style = eventTarget.style;
try {
style.removeProperty(ANIMATION_NAME_PROPERTY);
style.removeProperty(ANIMATION_DURATION_PROPERTY);
style.removeProperty(ANIMATION_FILL_MODE_PROPERTY);
style.removeProperty("-webkit-backface-visibility");
@@ -204,6 +203,8 @@ CSSAnimation.prototype.endEventListener = function()
eventTarget.removeEventListener(ANIMATION_END_EVENT_NAME, AnimationEndListener);
animation.listener = null;
delete (CURRENT_ANIMATIONS[animation.identifier]);
} catch (err) {
CPLog.warn("CSSAnimation.j - " + err);
}
};
@@ -260,11 +261,6 @@ CSSAnimation.prototype.buildDOMElements = function()
this.didBuildDOMElements = true;
}
CSSAnimation.prototype.setRemoveAnimationPropertyOnCompletion = function(flag)
{
this.removeAnimationPropertyOnCompletion = flag;
}
CSSAnimation.prototype.start = function()
{
if (this.propertyanimations.length == 0 || this.islive)