ExpectAnim
v1.0.1
وصف الرسوم المتحركة الخاصة بك وتشغيل!
new ExpectAnim ()
. expect ( avatar )
. toBe (
Expectations ...
)
. toAnimation ()
. start ();
في الوحدة الخاصة بك
compile ' com.github.florent37:expectanim:1.0.8 '
يصف هذا الرمز الفيديو أعلاه
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 ();
استخدم setPercent
لتطبيق تعديل الخطوة الحالية للرسوم المتحركة
مثال مع التمرير
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 );
}
});
يمكنك تشغيل حيوان تلو الآخر باستخدام ExpectAnim.concat
(طريقة ثابتة)
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()
استخدم setNow
لتطبيق التحويل مباشرة
new ExpectAnim ()
. expect ( view )
. toBe (
outOfScreen ( Gravity . BOTTOM )
)
. toAnimation ()
. setNow ();
استخدم reset
للعودة إلى الحالة الأولية لطرق العرض
expectAnim . reset ():
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()
)
-keep class com.github.florent37.expectanim.*{ *; }
-dontwarn com.github.florent37.expectanim.**
تمت إضافة تأخير البداية
تمت إضافة AcceptAnim.concat
مراجع المستمعين الثابتة
ألفا 0 يجبر العرض على أن يكون غير مرئي
وأضاف تقلب flips
flippedHorizontally()
flippedVertically()
flippedHorizontallyAndVertically()
withCameraDistance(1000f)
rotations
المضافة
المؤلف: فلوران شامبيني
المدونة : http://www.tutos-android-france.com/
فيشيز بلاتو موتو : https://www.fiches-plateau-moto.fr/
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.