All Projects → florent37 → Expectanim

florent37 / Expectanim

Licence: apache-2.0
Describe your animation and run !

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Expectanim

Arclayout
With Arc Layout explore new styles and approaches on material design
Stars: ✭ 1,662 (-40.37%)
Mutual labels:  material, design
Materialdesign2
A beautiful app designed with Material Design 2 using Android X.
Stars: ✭ 170 (-93.9%)
Mutual labels:  material, design
Motion
A library used to create beautiful animations and transitions for iOS.
Stars: ✭ 1,726 (-38.07%)
Mutual labels:  material, design
Materialize
Materialize, a CSS Framework based on Material Design
Stars: ✭ 38,630 (+1286.08%)
Mutual labels:  material, design
Material Colors Native
Material Colors - A React Native App to Select Material Colors for macOS.
Stars: ✭ 246 (-91.17%)
Mutual labels:  material, design
Materialdesigninxamltoolkit
Google's Material Design in XAML & WPF, for C# & VB.Net.
Stars: ✭ 11,603 (+316.33%)
Mutual labels:  material, design
Material Apex
A Material Design Theme for Oracle APEX
Stars: ✭ 161 (-94.22%)
Mutual labels:  material, design
Fiftyshadesof
An elegant context-care loading placeholder for Android
Stars: ✭ 1,110 (-60.17%)
Mutual labels:  material, design
Dialogsheet
An Android library to create fully material designed bottom dialogs similar to the Android Pay app.
Stars: ✭ 236 (-91.53%)
Mutual labels:  material, design
Shrine Materialdesign2
implementation of Material Design 2 Shrine project
Stars: ✭ 215 (-92.29%)
Mutual labels:  material, design
Materialdesigndemo
A beautiful app designed with Material Design.
Stars: ✭ 1,391 (-50.09%)
Mutual labels:  material, design
react-mdl-extra
React MDL Extra components
Stars: ✭ 41 (-98.53%)
Mutual labels:  design, material
Material Design For Bootstrap
Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
Stars: ✭ 9,463 (+239.54%)
Mutual labels:  material, design
Material Discord
Material design theme for Discord
Stars: ✭ 127 (-95.44%)
Mutual labels:  material, design
Vue Mdc
Material web components for Vue.js
Stars: ✭ 1,217 (-56.33%)
Mutual labels:  material, design
Material
A UI/UX framework for creating beautiful applications.
Stars: ✭ 11,870 (+325.91%)
Mutual labels:  material, design
Material Design Theme
🎨 A ex-theme for Discord according to Google's Material design Guidelines. Now moved to https://github.com/rauenzi/Nox
Stars: ✭ 50 (-98.21%)
Mutual labels:  material, design
Materialdesigncolor
This project shows the color in material design
Stars: ✭ 55 (-98.03%)
Mutual labels:  material, design
React Mdc Web
Material Design Components for React
Stars: ✭ 175 (-93.72%)
Mutual labels:  material, design
React Materialui Notifications
Spec compliant notifications for react and material ui users
Stars: ✭ 252 (-90.96%)
Mutual labels:  material, design

ExpectAnim

Android Arsenal CircleCI

Describe your animation and run !

Android app on Google Play

gif

new ExpectAnim()

                .expect(avatar)
                .toBe(
                    Expectations...
                )
                .toAnimation()
                .start();

Download

Buy Me a Coffee at ko-fi.com

In your module Download

compile 'com.github.florent37:expectanim:1.0.8'

This code describe the video above

new ExpectAnim()

                .expect(avatar)
                .toBe(
                        bottomOfParent().withMarginDp(16),
                        leftOfParent().withMarginDp(16),
                        width(40).toDp().keepRatio()
                )

                .expect(name)
                .toBe(
                        toRightOf(avatar).withMarginDp(16),
                        sameCenterVerticalAs(avatar),
                        toHaveTextColor(Color.WHITE)
                )

                .expect(subname)
                .toBe(
                        toRightOf(name).withMarginDp(5),
                        sameCenterVerticalAs(name),
                        toHaveTextColor(Color.WHITE)
                )

                .expect(follow)
                .toBe(
                        rightOfParent().withMarginDp(4),
                        bottomOfParent().withMarginDp(12),
                        toHaveBackgroundAlpha(0f)
                )

                .expect(message)
                .toBe(
                        aboveOf(follow).withMarginDp(4),
                        rightOfParent().withMarginDp(4),
                        toHaveBackgroundAlpha(0f)
                )

                .expect(bottomLayout)
                .toBe(
                        atItsOriginalPosition()
                )

                .expect(content)
                .toBe(
                        atItsOriginalPosition(),
                        visible()
                )

                .toAnimation()
                .setDuration(1500)

                .start();

Follow scroll

gif

Use setPercent to apply modify the current step of the animation

Exemple with a scrollview

this.expectAnimMove = new ExpectAnim()
                .expect(username)
                .toBe(
                        toRightOf(avatar).withMarginDp(16),
                        sameCenterVerticalAs(avatar),
                        alpha(0.5f)
                )

                .expect(avatar)
                .toBe(
                        topOfParent(),
                        leftOfParent().withMarginDp(16),
                        scale(0.5f, 0.5f)
                )
                .expect(follow)
                .toBe(
                        rightOfParent().withMarginDp(16),
                        sameCenterVerticalAs(avatar)
                )

                .expect(backbground)
                .toBe(
                        height(height).withGravity(Gravity.LEFT|Gravity.START, Gravity.TOP)
                )

                .toAnimation();

scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
    @Override
    public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
        final float percent = (scrollY * 1f) / v.getMaxScrollAmount();

        expectAnimMove.setPercent(percent);
    }
});

Concat

You can play an anim after one other using ExpectAnim.concat (static method)

ExpectAnim.concat(
                new ExpectAnim()
                        .expect(image1)
                        .toBe(
                                withCameraDistance(500f),
                                flippedHorizontally()
                        )
                        .toAnimation()
                        .setDuration(1000),
                new ExpectAnim()
                        .expect(image2)
                        .toBe(
                                withCameraDistance(1000f),
                                flippedVertically()
                        )
                        .toAnimation()
                        .setDuration(500)
                )
                .start()

Apply directly

Use setNow to apply directly the transformation

new ExpectAnim()
                .expect(view)
                .toBe(
                        outOfScreen(Gravity.BOTTOM)
                )
                .toAnimation()
                .setNow();

Reset

Use reset to return to the initial state of views

expectAnim.reset():

List of expectations

new ExpectAnim()
                .expect(view)
                .toBe(

                    //.withMargin(marginPx)
                    //.withMarginDp(margin)
                    //.withMarginDimen(R.dimen.margin)

                    toRightOf(view)
                    toLeftOf(view)
                    belowOf(view)
                    aboveOf(view)

                    atItsOriginalPosition()


                    sameCenterAs(view, horizontal, vertical)
                    sameCenterHorizontalAs(view)
                    sameCenterVerticalAs(view)
                    centerInParent(horizontal, vertical)
                    centerVerticalInParent()
                    centerHorizontalInParent()

                    centerBetweenViews(view1, view2, horizontal, vertical)
                    centerBetweenViewAndParent(otherView, horizontal, vertical, toBeOnRight, toBeOnBottom)

                    topOfParent()
                    rightOfParent()
                    bottomOfParent()
                    leftOfParent()

                    alignBottom(otherView)
                    alignTop(otherView)
                    alignLeft(otherView)
                    alignRight(otherView)

                    outOfScreen(gravitiy)  //Gravity.LEFT / Gravity.RIGHT / Gravity.TOP / Gravity.BOTTOM

                    alpha(alpha)
                    sameAlphaAs(otherView)
                    visible()
                    invisible()

                    //.keepRatio()
                    //.withGravity(horizontalGravity, verticalGravity)

                    atItsOriginalScale()

                    scale(scaleX, scaleY)
                    height(height)
                    width(width)
                    sameScaleAs(otherView)
                    sameWidthAs(otherView)
                    sameHeightAs(otherView)


                    toHaveTextColor(textColor)
                    toHaveBackgroundAlpha(alpha)

                    rotated(rotation)
                    vertical(bottomOfViewAtLeft)
                    atItsOriginalRotation()
                )

Proguard

-keep class com.github.florent37.expectanim.*{ *; }
-dontwarn com.github.florent37.expectanim.**

Changelog

1.0.7

Added startDelay

1.0.6

Added ExpectAnim.concat

1.0.4

Fixed listeners references

1.0.3

Alpha 0 force view to be INVISIBLE`

1.0.2

Added flips rotations

flippedHorizontally() flippedVertically() flippedHorizontallyAndVertically() withCameraDistance(1000f)

1.0.1

Added rotations

gif

Credits

Author: Florent Champigny

Blog : http://www.tutos-android-france.com/

Fiches Plateau Moto : https://www.fiches-plateau-moto.fr/

Android app on Google Play Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2017 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].