-
-
Notifications
You must be signed in to change notification settings - Fork 19
Hyperloop
Michael Gangolf edited this page Feb 18, 2018
·
6 revisions
Lottie can be used in Hyperloop, too:
- create a new Hyperloop project
- place the
lottie-release.aar
intoapp/platform/android/
var LottieAnimationView = require('com.airbnb.lottie.LottieAnimationView');
var Animator = require('android.animation.Animator');
var ValueAnimator = require('android.animation.ValueAnimator');
var ScaleType = require('android.widget.ImageView.ScaleType');
var lottieView = new LottieAnimationView(Ti.Android.currentActivity);
var animation = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, '/animation.json').read().text;
$.index.add(lottieView);
lottieView.addAnimatorListener(new Animator.AnimatorListener({
onAnimationStart: function() {
console.log("start");
},
onAnimationEnd: function() {
console.log("end");
},
onAnimationRepeat: function() {
console.log("repeat");
}
}));
lottieView.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener({
onAnimationUpdate: function(ani) {
console.log("Percentage", lottieView.getProgress().toFixed(2));
}
}));
lottieView.setAnimationFromJson(animation);
lottieView.setScaleType(ScaleType.CENTER_INSIDE);
lottieView.loop(true);
lottieView.playAnimation();
$.index.open();