How to use a variable to precisely control multiple variables

Source: Internet
Author: User

minimum key frame principle

This principle is my work in peacetime summed up, "the minimum key frame principle." That is, I am always happy to use as few keyframes as I can to achieve the same animation effect. As mentioned in the previous article, use expressions to eliminate "redundant" keyframes, as much as possible by a variable to dominate other variables. This is done not only later modified to be handy, rhythm easy to control, and the whole document is very concise, looking happy, more efficient nature.

Introduction & Usage of linear expressions

Child parent link, the link between expression attributes can be implemented by a variable to control multiple variables. When it comes to the link, we have to mention the expression "linear", its existence for me to win more brush UI China's time, haha, that is, since using "linear", one breath to do 5 needs, not laborious, who knows Ah!

Again, let's take a look at how the official defines "linear":

Interpolation method (excerpt)

Linear (T, value1, value2)

return type: Numeric or array.

The parameter T is usually time or value, but it can also take other values. If T is time, the interpolation between the values occurs over a duration. If T is value, the expression maps a series of values to the new series values.

Again, we can call it in the expression library:

Through the official brief introduction you can understand "linear" is a thing? If you understand, this tutorial ends here. At least when I looked at it, I thought Adobe's Chinese version of the Help document was translated directly into the English version of Google. Do not understand Ah!?

After 9,981 days of fermentation, I understand!

In fact, it is not complex, along the look down to believe that we can learn.

We mainly look at this statement, linear (T, Tmin, TMax, value1, value2). As mentioned in the official definition above, if T is value, the expression maps a series of values to the new series values. And we're just going to take advantage of this mapping function, remember our title? "' Accurately ' control multiple variables '.

Also take a small example to help us analyze.

There is a a,b two circle, first on the x axis of a circle to do the movement of key frame animation, a circle from 128 to 670, the following figure:

Then we point to the X-position attribute of the B-circle (right-alone size), click on the Expression window, and associate it to the x axis of a circle, as shown below:

Immediately thereafter, we define an "Ax" and Let Ax=thiscomp.layer ("a Circle"). Transform.xposition; (note ";") Equal to a period, don't forget it. Then call the "linear" expression and change the parameters inside, as shown in the following figure:

Ax=thiscomp.layer ("a Circle"). Transform.xposition;

Linear (ax,128,670,128,420)

Take a closer look at the numbers in the parentheses behind the "linear" and then we'll feel the effect of the "linear":

See here I think we all understand it, is not so easy. What the!? Don't get it!

Change it a little bit and see:

Ax=thiscomp.layer ("a Circle"). Transform.xposition;

Linear (ax,128,300,128,620)

(I have first put a circle of displacement animation to 128 to 300 oh, if not changed, we can imagine what kind of situation.) )

Through the example above, we can see how the "linear" of "mapping" works. Simple interpretation of "linear (ax,128,300,128,620)", when the Ax from 128 to 300, mapping out 128 to 620 of the value, that is, ax=128 output 128,ax=300 when output 620, the output corresponds to the value of the B-circle X-axis properties. We also define the X axis position attribute of a circle to "Ax", so it is equivalent to map the x axis of a circle to the x axis of B circle, as to the specific range of variation, see how the parameters in parentheses are defined.

Note that the mapped objects are not one-to-one, can be one-to-many, and that you do not need the x axis map x axis, you can map the y-axis to x axes, even the x axis map transparency, scaling, rotation, and so on. Concrete how to shoot the method still depends on your tiwei, is the physical strength, is not, is the ability. In short, "linear" will make the elements of your animation more closely related, rather than isolated individuals.

is so simple and practical, that is to learn to use the mapping skills, you have learned?

Simple Demonstration & ideas sharing

In the example above, a circle is the dominant object, which influences the movement of B circles by his motion. In many cases I need to choose the right dominant object, because it is animated by the dominant object, and the general keyframe is hit on it. Therefore, according to the specific situation to analyze, the selection of the dominant target on your work behind the impact of significant. Generally I choose to be the most closely related to the finger operation of the object as the dominant.

The following simple demonstration and analysis of some of my small examples, due to the length of the reasons I do not make specific analysis of the details, the method is also different from each other, designed to share Kazakhstan.

Example 1:

Train of thought: the height of the banner to map the scale of the background map;

Example 2:

Train of thought: The x-axis of the side bar to map the Zoom & fillet & Grayscale of the home page;

Example 3:

Idea: the y axis of the top layer maps its own zoom & fillet, while mapping the Y axis & zoom & Fillet of the 2nd, 3 layers;

Example 4:

Idea: The size of the blue circle map Polygon, the roundness of the Leng map polygon, the yellow circle map background color and so on;

Example 5:

Train of thought: the rotation map number of the knob changes from 0 to 10& background color & tick bar and so on;

Example 6:

Train of thought: the first round of the contraction projection to shoot the other circles of the Zoom & projection & foot scaling, etc.

Example to the end of the ~

Hope to give you a little inspiration ah ~

At last

Do you want to know how to achieve this ventilation dot? But the length is too long, please listen to let's.

Related Keywords:
Related Article E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD