Skip to content

Instantly share code, notes, and snippets.

Avatar

Ruslan Urmeev russelarms

View GitHub Profile
View OffsetAnimator_listing_18.java
public class MainActivity extends AppCompatActivity {
@BindView(R.id.animator_scene)
AnimatorScene scene;
...
private void initPagerListeners() {
ViewPagerAnimatorAdapter animatorAdapter = new ViewPagerAnimatorAdapter(scene.getScene());
viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
View OffsetAnimator_listing_17.java
scene.page(3).step(4)
.createAnimation(() -> AnimatorFactory.createAnimator(submarine.getScaleX(), submarine.getScaleX() * 2))
.setListener(value -> {
submarine.setScaleX(value);
submarine.setScaleY(value);
});
scene.page(3).step(5)
.createAnimation(1, 0.5f)
.setListener(value -> {
View OffsetAnimator_listing_16.java
scene.page(2).step(2)
.createAnimation(0, 90)
.setDuration(0.25f)
.setListener(value -> submarine.setRotation(value));
scene.page(2).step(3)
.createAnimation(90, 180)
.setStartThreshold(0.25f)
.setDuration(0.25f)
.setListener(value -> submarine.setRotation(value));
View OffsetAnimator_listing_15.java
scene.page(2).step(0)
.createAnimation(() -> AnimatorFactory.createArcAnimator(submarine,
ArcUtils.centerX(submarine),
ArcUtils.centerY(submarine),
ArcUtils.centerX(submarine),
dipToPx(48),
180f, ArcSide.LEFT))
.setDuration(0.5f);
View OffsetAnimator_listing_14.java
scene.page(1).step(0)
.createAnimation(1926, 1032)
.setInterpolator(new SpringInterpolator(0.8f))
.setListener(value -> submarine.setY(value));
View OffsetAnimator_listing_13.java
private void initSteps() {
scene.page(0).step(0)
.createAnimation(ocean.getY(), ocean.getY() - dipToPx(120))
.setDuration(0.8f)
.setListener(value -> ocean.setY(value));
scene.page(0).step(1)
.createAnimation(fishLeft.getX(), fishLeft.getX() + dipToPx(160))
.setDuration(0.3f)
.setStartThreshold(0.5f)
You can’t perform that action at this time.