Skip to content

Commit

Permalink
Merge pull request #34 from gameclosure/new-animate-groups
Browse files Browse the repository at this point in the history
New animate groups
  • Loading branch information
rogueSkib committed Jul 31, 2015
2 parents 9094652 + e2dce39 commit ad7ddd5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/native-android
2 changes: 1 addition & 1 deletion modules/native-ios
2 changes: 1 addition & 1 deletion modules/timestep
18 changes: 10 additions & 8 deletions src/clientapi/native/timestep.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import device;
import lib.PubSub as PubSub;

var hasNativeViews = GLOBAL.NATIVE && NATIVE.timestep && NATIVE.timestep.View;

Expand All @@ -39,15 +40,16 @@ function installNativeView() {
timestep.NativeImageView.install();

var animate = device.importUI('animate');
var ViewAnimator = animate.getViewAnimator();
// use accelerated native view animators
animate.setViewAnimator(NATIVE.timestep.Animator);
merge(NATIVE.timestep.Animator.prototype, {
subscribe: function () {},
pause: function () {},
resume: function () {},
__finish: function () {},
_isRunning: function () {}
});

// native view animators inherit from PubSub (Emitter) to match JS
merge(NATIVE.timestep.Animator.prototype, PubSub.prototype);
// native view animators need to add themselves to animate groups in JS
NATIVE.timestep.Animator.prototype._addToGroup = ViewAnimator.prototype._addToGroup;
// native view animators need to remove themselves from animate groups in JS
NATIVE.timestep.Animator.prototype._removeFromGroup = ViewAnimator.prototype._removeFromGroup;

// add some properties to View and ImageView to defer to native rendering
import ui.View as View;
View.prototype.__type = VIEW_TYPES.DEFAULT;
Expand Down

0 comments on commit ad7ddd5

Please sign in to comment.