Skip to content

Commit

Permalink
Use a single animator and compDuration for all layers (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Peal committed Oct 6, 2016
1 parent 3eab742 commit b39627c
Show file tree
Hide file tree
Showing 41 changed files with 492 additions and 234 deletions.
Binary file modified LotteSample/screenshots/CheckSwitch 15.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 LotteSample/screenshots/CheckSwitch 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 LotteSample/screenshots/CheckSwitch 25.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 LotteSample/screenshots/CheckSwitch 75.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
285 changes: 285 additions & 0 deletions LotteSample/src/main/assets/CheckCircle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
{
"assets":[

],
"v":"4.3.1",
"ddd":0,
"layers":[
{
"ddd":0,
"ind":3,
"ty":4,
"nm":"White BG Outlines",
"ks":{
"o":{
"k":100
},
"r":{
"k":0
},
"p":{
"k":[
{
"i":{
"x":0,
"y":1
},
"o":{
"x":0.52,
"y":0
},
"n":"0_1_0p52_0",
"t":15,
"s":[
70.347,
49.429,
0
],
"e":[
49.428,
49.429,
0
],
"to":[
0,
0,
0
],
"ti":[
0,
0,
0
]
},
{
"i":{
"x":0,
"y":0
},
"o":{
"x":0.167,
"y":0.167
},
"n":"0_0_0p167_0p167",
"t":35,
"s":[
49.428,
49.429,
0
],
"e":[
49.428,
49.429,
0
],
"to":[
0,
0,
0
],
"ti":[
0,
0,
0
]
},
{
"i":{
"x":0.18,
"y":1
},
"o":{
"x":0.5,
"y":0
},
"n":"0p18_1_0p5_0",
"t":86,
"s":[
49.428,
49.429,
0
],
"e":[
70.347,
49.429,
0
],
"to":[
0,
0,
0
],
"ti":[
0,
0,
0
]
},
{
"t":106
}
]
},
"a":{
"k":[
24.25,
24.25,
0
]
},
"s":{
"k":[
99.867,
99.925,
100
]
}
},
"shapes":[
{
"ty":"gr",
"it":[
{
"ind":0,
"ty":"sh",
"closed":true,
"ks":{
"k":{
"i":[
[
-17.673,
0
],
[
0,
17.673
],
[
17.673,
0
],
[
0,
-17.673
]
],
"o":[
[
17.673,
0
],
[
0,
-17.673
],
[
-17.673,
0
],
[
0,
17.673
]
],
"v":[
[
8.544,
32.018
],
[
40.544,
0.018
],
[
8.544,
-31.982
],
[
-23.456,
0.018
]
]
}
},
"nm":"Path 1"
},
{
"ty":"fl",
"fillEnabled":true,
"c":{
"k":[
1,
0,
0,
1
]
},
"o":{
"k":100
},
"nm":"Fill 1"
},
{
"ty":"tr",
"p":{
"k":[
7.125,
24.25
],
"ix":2
},
"a":{
"k":[
0,
0
],
"ix":1
},
"s":{
"k":[
93,
93
],
"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":"Group 1"
}
],
"bounds":{
"l":-15,
"t":-6,
"b":55,
"r":45
},
"ip":0,
"op":170,
"st":0,
"bm":0,
"sr":1
}
],
"ip":0,
"op":150,
"fr":60,
"w":100,
"h":100
}
1 change: 1 addition & 0 deletions LotteSample/src/main/assets/Circles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"assets":[],"v":"4.3.1","ddd":0,"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"Shape Layer 2","ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":68,"s":[200,200,0],"e":[810,200,0],"to":[0,0,0],"ti":[0,0,0]},{"t":217}]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"ty":"fl","fillEnabled":true,"c":{"k":[1,0,0,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[-292.484,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"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"}],"bounds":{"l":-401,"t":-109,"b":109,"r":-184},"ip":68,"op":178,"st":68,"bm":0,"sr":1},{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 4","ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":-82,"s":[200,200,0],"e":[810,200,0],"to":[0,0,0],"ti":[0,0,0]},{"t":67}]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"ty":"fl","fillEnabled":true,"c":{"k":[1,0,0,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[-292.484,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"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"}],"bounds":{"l":-401,"t":-109,"b":109,"r":-184},"ip":-16,"op":68,"st":-82,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[200,200,0],"e":[810,200,0],"to":[0,0,0],"ti":[0,0,0]},{"t":149}]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"d":1,"ty":"el","s":{"k":[161.227,161.227]},"p":{"k":[0,0]},"nm":"Ellipse Path 1","closed":true},{"ty":"fl","fillEnabled":true,"c":{"k":[1,0,0,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[-292.484,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"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"}],"bounds":{"l":-401,"t":-109,"b":109,"r":-184},"ip":0,"op":150,"st":0,"bm":0,"sr":1}],"ip":0,"op":150,"fr":60,"w":400,"h":400}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.SeekBar;
import android.widget.ToggleButton;

import com.airbnb.lotte.LotteAnimationView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;

public class AnimationFragment extends Fragment {
Expand All @@ -28,6 +30,7 @@ static AnimationFragment newInstance(String fileName) {

@BindView(R.id.animation_view) LotteAnimationView animationView;
@BindView(R.id.seek_bar) AppCompatSeekBar seekBar;
@BindView(R.id.loop_button) ToggleButton loopButton;

@Nullable
@Override
Expand Down Expand Up @@ -62,4 +65,9 @@ public void onStopTrackingTouch(SeekBar seekBar) {
public void onPlayClicked() {
animationView.play();
}

@OnCheckedChanged(R.id.loop_button)
public void onLoopChanged(boolean loop) {
animationView.loop(loop);
}
}
20 changes: 17 additions & 3 deletions LotteSample/src/main/res/layout/fragment_animation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,30 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/play"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play"/>
android:orientation="vertical">
<Button
android:id="@+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play"/>

<ToggleButton
android:id="@+id/loop_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="Loop"
android:textOff="Single"/>
</LinearLayout>


<android.support.v7.widget.AppCompatSeekBar
android:id="@+id/seek_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"/>
</LinearLayout>

Expand Down
Loading

0 comments on commit b39627c

Please sign in to comment.