Recently happened to help people do a picture of the page-turn of the flash, so a new look at flash pictures in the way code! Previously wrote some, but the effect of scrolling is not too good, the basic principle is to take the difference between the starting value and the final value, and then divided by a moving factor in the way to write! function mov () {
LX = n*w;
BTX = btx+ (LX-BTX)/6;
this._x = Math.Round (0-BTX);
A piece of code that was written before! LXAs the final value BTXis actually worth 6 for a coefficientAnd then passed without a shift. this._x = Math.Round (0-BTX);To assign a value. The disadvantage is that when the picture is moving, the last few shifts are very short and the visual effects are somewhat discounted. See this website to know, http://www.grigoriandesign.com/, this website moves the way I use this piece of old code. These days I have again studied the GROUP94 mobile code, found that they are a lot smarter in this area, the whole picture in the movement of the effect is also very helpful, basically in the last few frames, it took a way of rounding. The code is as follows: MovieClip.prototype.xPOS = function (A, d) {
This.xd = this.epy-this._x;
This.xa = (THIS.XD/A+THIS.XA)/D;
this._x = This._x+this.xa;
if (Math.Abs (this.xa) <0.500000 && math.abs (this.xd) <0.500000) {
This.xd = this.xa=0;
this._x = This.epy;
THIS.XCTV = false;
}
}; which this.epy as the final value, XD is the displacement between 2 points, then it is a 2 coefficient to control the entire movement, so the subdivision will be much better, and finally it uses a judgment to do a position of the rounding. The whole move will be much prettier! Notice that there may be a lot of people who don't quite understand MovieClip.prototype.xPOS = function (A, d) {} What is the point, in fact, the meaning of the break program is to give MovieClip plus a custom function, later in the movie any MovieClip can call this function, no longer need to redefine!! Relative to the novice, pull ... The old bird's going to figure it out. Pull!!:)Have time to learn to learn the code of foreigners is very good!
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.