Place the cursor on the thumbnail and rotate the image horizontally.

Source: Internet
Author: User
Tags benchmark

 

The elasticity is really hard to do. I tried it for one afternoon and didn't make it out:

// Total number of images:
Total = 7;
// Spacing:
D = 25;
// Image width:
W = 100;
// Total length:
W = total * (w + d );
// The speed at which the image gets bigger and smaller:
DScale = 10;
// Add images to the scene:
For (I = 1; I <= total; I ++ ){
This. attachMovie ("pic", "pic" + I, I, {_ x: I * (w + d)-W/2 });
Pic = this ["pic" + I];
Pic. gotoAndStop (I );
// Place the cursor over the image:
Pic. Onrolover = function (){
This. onEnterFrame = function (){
// Increase:
This. _ xscale = this. _ yscale + = dScale;
// Adjust the distance based on the image:
Pic0 = this;
Distance (pic0 );
// If it reaches a certain level, it will stop increasing:
If (this. _ xscale> 200 ){
This. _ xscale = this. _ yscale = 200;
Delete this. onEnterFrame;
Pic0 = head;
   }
};
};
// Move the mouse away from the image:
Pic. Onrolout = function (){
This. onEnterFrame = function (){
// Decrease:
This. _ xscale = this. _ yscale-= dScale;
// Adjust the distance based on the image:
Pic0 = this;
Distance (pic0 );
// If it is small to a certain extent, it will stop becoming smaller:
If (this. _ xscale <100 ){
This. _ xscale = this. _ yscale = 100;
Delete this. onEnterFrame;
Pic0 = head;
   }
};
};
// Create something similar to a two-way linked list:
Pic. prevPic = prevPic;
PrevPic. nextPic = pic;
PrevPic = pic;
}
// Forming a link chain:
This. pic1.prevPic = this ["pic" + total];
This ["pic" + total]. nextPic = this. pic1;
//
Head = this. pic1;
Tail = this ["pic" + total];
// Use the chain header as the benchmark (used to adjust the distance ):
Pic0 = head;
//
Function onEnterFrame (){
If (head. _ x <-W/2 ){
Head. _ x = tail. _ x + (tail. _ width + head. _ width)/2 + d;
Tail = head;
Head = head. nextPic;
Pic0 = head;
} Else if (tail. _ x> W/2 ){
Tail. _ x = head. _ x-(tail. _ width + head. _ width)/2-d;
Head = tail;
Tail = tail. prevPic;
Pic0 = head;
 }
Head. _ x + =-_ xmouse/20;
Distance (pic0 );
}
// Configure //--------------------------------------------------------------------------------------------
// Use pic0 as the benchmark to adjust the distance between Pictures:
Function distance (pic0 ){
Var pic = pic0;
While (pic! = Head ){
Pic. prevPic. _ x = pic. _ x-(pic. _ width + pic. prevPic. _ width)/2-d;
Pic = pic. prevPic;
 }
Pic = pic0;
While (pic! = Tail ){
Pic. nextPic. _ x = pic. _ x + (pic. _ width + pic. nextPic. _ width)/2 + d;
Pic = pic. nextPic;
 }
}

 

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.