Enterprise-level projects, adding animations to the pop-up and hide la S, and enterprise-level la s

Source: Internet
Author: User

Enterprise-level projects, adding animations to the pop-up and hide la S, and enterprise-level la s
For enterprise-level projects, the layout is boring and you can add animations to the layout,

When LayoutTransition is used, only setVisibility (View. VISIBLE) is used, but the display and disappearance are too sudden. So I joined the animation, look at the code http://download.csdn.net/detail/kan1kan5/7965869


// Declare the animation resetTransition (); // initialize the animation initAnim ();
Private void resetTransition () {mTransitioner = new LayoutTransition (); levelOkLayout. setLayoutTransition (mTransitioner);} private void initAnim () {mTransitioner. setStagger (LayoutTransition. CHANGE_APPEARING, 30); mTransitioner. setStagger (LayoutTransition. CHANGE_DISAPPEARING, 30); setupCustomAnimations (); long duration; duration= 500; mTransitioner. setDuration (duration);} // set the Custom Animation method private void setupCustomAnimations () {// Changing while Adding PropertyValuesHolder pvhLeft = PropertyValuesHolder. ofInt ("left", 0, 1); PropertyValuesHolder pvhTop = PropertyValuesHolder. ofInt ("top", 0, 1); PropertyValuesHolder pvhRight = PropertyValuesHolder. ofInt ("right", 0, 1); PropertyValuesHolder pvhBottom = PropertyValuesHolder. ofInt ("bottom", 0, 1); PropertyValuesHolder pvhScaleX = PropertyValuesHolder. ofFloat ("scaleX", 1f, 0f, 1f); PropertyValuesHolder pvhScaleY = PropertyValuesHolder. ofFloat ("scaleY", 1f, 0f, 1f); final ObjectAnimator changeIn = ObjectAnimator. ofPropertyValuesHolder (this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhScaleX, pvhScaleY ). setDuration (mTransitioner. getDuration (LayoutTransition. CHANGE_APPEARING); mTransitioner. setAnimator (LayoutTransition. CHANGE_APPEARING, changeIn); changeIn. addListener (new AnimatorListenerAdapter () {public void onAnimationEnd (Animator anim) {View view = (View) (ObjectAnimator) anim ). getTarget (); view. setScaleX (1f); view. setScaleY (1f );}});
// Changing while Removing Keyframe kf0 = Keyframe. ofFloat (0f, 0f); Keyframe kf1 = Keyframe. ofFloat (. 9999f, 360f); Keyframe kf2 = Keyframe. ofFloat (1f, 0f); PropertyValuesHolder pvhRotation = PropertyValuesHolder. ofKeyframe ("rotation", kf0, kf1, kf2); final ObjectAnimator changeOut = ObjectAnimator. ofPropertyValuesHolder (this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhRotation ). setDuration (mTransitioner. getDuration (LayoutTransition. CHANGE_DISAPPEARING); mTransitioner. setAnimator (LayoutTransition. CHANGE_DISAPPEARING, changeOut); changeOut. addListener (new AnimatorListenerAdapter () {public void onAnimationEnd (Animator anim) {View view = (View) (ObjectAnimator) anim ). getTarget (); view. setRotation (0f );}});
// Adding ObjectAnimator animIn = ObjectAnimator. ofFloat (null, "rotationY", 90f, 0f ). setDuration (mTransitioner. getDuration (LayoutTransition. APPEARING); mTransitioner. setAnimator (LayoutTransition. APPEARING, animIn); animIn. addListener (new AnimatorListenerAdapter () {public void onAnimationEnd (Animator anim) {View view = (View) (ObjectAnimator) anim ). getTarget (); view. setRotationY (0f );}});
// Removing ObjectAnimator animOut = ObjectAnimator. ofFloat (null, "rotationX", 0f, 90f ). setDuration (mTransitioner. getDuration (LayoutTransition. DISAPPEARING); mTransitioner. setAnimator (LayoutTransition. DISAPPEARING, animOut); animOut. addListener (new AnimatorListenerAdapter () {public void onAnimationEnd (Animator anim) {View view = (View) (ObjectAnimator) anim ). getTarget (); view. setRotationX (0f );}});
}
For layoutTransition:

LayoutTransition class is used to process layout changes in ViewGroup. When you call the setVisibility () method of a View object, set the GONE constant of the View, or add the View object to the ViewGroup (or delete it from the ViewGroup, the View object inside the ViewGroup can achieve the animation effect of the current time. When a View object is added or deleted in a ViewGroup object, other View objects can be animated to a new position. In the LayoutTransition object, you can define the animation represented by the constant by calling the setAnimator () method and passing the following LayoutTransition constant to the Animator object parameter of the method:

1. APPEARING --- a tag that indicates that an animation is to be run on the displayed project in the container;

2. change appearing --- a tag that indicates the animation to be run for changes to other projects in the container due to the appearance of a new project;

3. DISAPPEARING --- a tag that indicates the animation to be run for a project that disappears from the container;

4. CHANGE_DISAPPEARING --- a tag that indicates the animation to be run because a project disappears from the container and changes other projects.

You can define custom animations for these four event types to customize the layout transition effect. You can also tell the animation system to only use the default animation effect.

The LayoutAnimations example in APIDemo shows how to define the animation effect for the layout transition and set the animation on the View object for the animation effect.

The LayoutAnimationsByDefault class and its corresponding layout_animations_by_default.xml layout resource file show how to enable the default layout transition effect of ViewGroup objects in XML. You only need to set the android. animateLayoutchanges attribute of the ViewGroup element to true. For example:

<LinearLayout

Android: orientation = "vertical"

Android: layout_width = "wrap_content"

Android: layout_height = "match_parent"

Android: id = "@ + id/verticalContainer"

Android: animateLayoutChanges = "true"/>

If this attribute is set to true, you can add or delete a View object to or from the ViewGroup object, and other View objects in the ViewGroup object will be automatically animated.

Use TypeEvaluator www.2cto.com

If the animation type you want is unknown to the Android system, you can create your own evaluators by implementing the TypeEvaluator interface. The available types of Android systems are int, float, or color, which are supported by evaluators of the IntEvaluator, FloatEvaluator, and ArgbEvaluator types.

There is only one method to implement in the TypeEvaluator interface: The evaluate () method. This method allows an animation processor in use to return an animation attribute value suitable for the current animation time point. The FloatEvaluator class demonstrates how this method works:

Public class FloatEvaluator implements TypeEvaluator {

Public Object evaluate (float fraction, Object startValue, Object endValue ){

Float startFloat = (Number) startValue). floatValue ();

Return startFloat + fraction * (Number) endValue). floatValue ()-startFloat );

}

}

Note: When the ValueAnimator object (or ObjectAnimator object) is running, it calculates the past factor of the current animation (a value between 0 and 1 ), calculate the version of the animation to be inserted based on the interpolation type you use. The interpolation factor is received by the TypeEvaluator object through the fraction parameter. Therefore, interpolation is not required when calculating the animation value.


 

This article briefly describes how to use the timeline to create a mobile button and hide the animation effect of a video.

You should talk about the timeline in dw. 1. Create a blank file, click the "Draw layer" button in "layout", and draw a layer at will, in the attribute panel, adjust the layer size and position, insert the animation you want to put, and click "insert"-layout object-layer in the menu, insert a nested layer (this layer is used to insert the close button of the hidden layer, which usually pops up on the page) and sets the layer position (bottom right or top right) similar to the size (16-24px), insert an image with the close button in the nested layer. Then, select the first layer (placed in the animation layer), click "modify"-"timeline"-"Recording layer path" in the menu, and drag the layer to move, the timeline will remember the moving track and turn it into a frame, release the mouse, and all the moving tracks are recorded in the timeline. You can automatically select the playback mode on the timeline. When the page is loaded, the layer begins to move. Select the picture of the nested layer, click the behavior panel on the right, add the behavior, and select "show-hide layer" to hide the animation layer. OK, select, onclick, save, and preview. 2. There are many types of navigation bars on the website, including text, flash, FW, or css drop-down menus. Let me show you the simplest text. The text is to write a line of page link text you want to do, and then add a link in the property panel one by one. For example, upload or index. asp. Then, select "company News" and give the file to the page at the link. If you are too lazy to enter it, You can directly place the "cross-colored circle" behind the address box and drag it to the subpage file corresponding to the link.

How to remove the sequence number after adding an animation effect to a ppt

You can turn off the Custom Animation bar .. In fact, it is not displayed during playback.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.