Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter van der Zee committed Nov 20, 2012
1 parent 0d88736 commit b2e7e3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 42 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -2,6 +2,7 @@
* Added all instance properties of KeyframeAnimation to the prototype and documented them
* Removed unused KeyframeAnimation#removeSubject and #removeSubjects
* Fixed an issue with KeyframeAnimation where it would trip over certain undefined values
* Fixed a bug in _fillInProperties where it would refer to the wrong instance property easingFn (-> easing)

v0.4.2
-------------------
Expand Down
49 changes: 7 additions & 42 deletions src/runner/animation/keyframe_animation.js
Expand Up @@ -44,25 +44,23 @@ define([
* frames or seconds
*/
function KeyframeAnimation(clock, duration, keyframes, options) {
options || (options = {});
if (!options) options = {};

this.clock = clock;
duration = this.duration = +duration || clock.toFrameNumber(duration);

this._parseEventProps(options);

this.subjects = [];
this.initialValues = null;

// Looks wonky, but because repeat allows Infinity, combining it into
// `(repeat-(repeat%1))||0` would result in 0, rather than Infinity.
this.repeat = (options.repeat || 0) - (options.repeat % 1 || 0);

this.delay = options.delay && clock.toFrameNumber(options.delay) || 0;
this.delay = (options.delay && clock.toFrameNumber(options.delay)) || 0;
this.isTimelineBound = options.isTimelineBound !== false;

var easingFunc = options.easing;
this.easing = getEasingFunction(easingFunc);
this.easing = getEasingFunction(options.easing);

this.prevFrame = 0;
this.frame = 0;
Expand Down Expand Up @@ -107,22 +105,16 @@ define([
* @property {number} duration Number of entire animation in frames
*/
duration: -1,
/**
* depricated
*/
easing: null,
/**
* @private
* @property {Function} easingFn The easing function which transforms the actual progress
* @property {Function} easing The easing function which transforms the actual progress
*/
easingFn: null,
easing: null,
/**
* @private
* @property {number} frame depricated?
* @property {number} frame Current frame position (=> relates to progress of animation)
*/
frame: -1,
/** depricated **/
initialValues: null,
/**
* @private
* @property {boolean} isPlaying Is this animation currently applying changes?
Expand Down Expand Up @@ -385,33 +377,6 @@ define([
return this;
},

/**
* Removes a subject from the animation
*
* @param {Object} subject The subject to remove
*/
removeSubject: function(subject) {
for (var i = 0, l = this.subjects.length; i < l; ++i) {
if (this.subjects[i].subject === subject) {
this.subjects.splice(i, 1);
for (var a = 0, al = this.animations.length; a < al; ++a) {
this.animations[a].removeSubject(subject);
}
}
}
},

/**
* Removes a subject from the animation
*
* @param {Object[]} subjects Array of subjects to remove (usually display objects)
* @return {KeyframeAnimation}
*/
removeSubjects: function(subjects) {
forEach(subjects, tools.hitch(this, 'removeSubject'));
return this;
},

/**
* Creates a PropertiesTween object for each phase of the keyframe animation.
* Note that the startValues may have undefined properties, these need to be
Expand Down Expand Up @@ -472,7 +437,7 @@ define([
*/
_fillInProperties: function(initialValues) {

var easingFn = this.easingFn,
var easingFn = this.easing,
lastFrame = this.duration,
keys = this.keys,
keyframes = this.keyframes,
Expand Down

0 comments on commit b2e7e3f

Please sign in to comment.