Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent parent layers from overwriting child layer's alpha #48

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified LottieSample/screenshots/PinJump 0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/PinJump 10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/PinJump 20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/PinJump 5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/PinJump 50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/Tests_Alarm 100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/Tests_Alarm 20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LottieSample/screenshots/Tests_Alarm 50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LottieSample/screenshots/Tests_EllipseTrimPath 0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LottieSample/screenshots/Tests_EllipseTrimPath 5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ public void testAll() {
TestRobot.testAnimation(getActivity(), "Tests/LoopPlayOnce.json");
TestRobot.testAnimation(getActivity(), "Tests/Alarm.json");
TestRobot.testAnimation(getActivity(), "Tests/CheckSwitch.json");
TestRobot.testAnimation(getActivity(), "Tests/EllipseTrimPath.json");
}
}
1 change: 1 addition & 0 deletions LottieSample/src/main/assets/Tests/EllipseTrimPath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"assets":[],"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"Oval 2","ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[51.972,46.722,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[10.056,10.056]},"p":{"k":[0,0]},"nm":"Ellipse Path 1"},{"ty":"st","fillEnabled":true,"c":{"k":[0,0.9,0.46,1]},"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":14,"s":[100],"e":[0]},{"t":15}]},"w":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":3,"s":[5],"e":[0.1]},{"t":14}]},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.9,0.46,1]},"o":{"k":0},"nm":"Fill 1"},{"ty":"tr","p":{"k":[-1.972,3.278],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":4,"s":[170,170],"e":[300,300]},{"t":14}],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1"}],"ip":4,"op":58,"st":-36,"bm":0,"sr":1}],"v":"4.4.26","ddd":0,"ip":0,"op":66,"fr":60,"w":100,"h":100}
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@ void addLayer(AnimatableLayer layer) {
layer.parentLayer = this;
layers.add(layer);
layer.setProgress(progress);
if (this.alpha != null) {
layer.setAlpha(this.alpha);
}
invalidateSelf();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.airbnb.lottie.layers;

import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
Expand Down Expand Up @@ -82,17 +81,13 @@ public void onValueChanged(PointF progress) {
}
};

private final Paint paint = new Paint();
private final Path path = new Path();

private KeyframeAnimation<PointF> circleSize;
private KeyframeAnimation<PointF> circlePosition;

CircleShapeLayer(Drawable.Callback callback) {
super(callback);
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);

setPath(new StaticKeyframeAnimation<>(path));
}

Expand Down