图片横线滚动脚本
This is a popular effect, and it’s easy to do! Here’s how…
这是一个流行的效果,而且很容易做到! 这是如何做…
1. Set the frame properties first. The size should be 420 X 90 pixels, and the frame rate should be 25 frames per second.
1.首先设置框架属性。 大小应为420 X 90像素,并且帧速率应为每秒25帧。
2. Import a background picture. I made the background picture in photoshop, and its size was 700 X 85 pixels.
2.导入背景图片。 我在photoshop中制作了背景图片,其尺寸为700 X 85像素。
3. Select the background picture and convert it to a movie clip. Name it bg_static.
3.选择背景图片并将其转换为影片剪辑。 将其命名为bg_static。
4. Give this an instance name of "bg".
4.为其指定实例名称“ bg”。
5. Create a movieclip that’s 1045 X 40 pixels. Give this an instance name of "menu".
5.创建一个1045 X 40像素的动画片段。 给它指定一个实例名称“菜单”。
6. Select the first frame and insert this action:
6.选择第一帧并插入以下操作:
xm = 0; //function to set the xpos of the movieclip function xpos(bar_length,mul) { hpos = 0; scroll_length = 420; incr = bar_length/scroll_length; xm = _xmouse; if(_xmouse <= 10){xm = 10;} if(_xmouse >= 400){xm = 400;} scroll_x = hpos - xm; scroll_x = scroll_x * mul; x_pos = scroll_x * incr; x_pos = x_pos + hpos; return x_pos; } _root.onEnterFrame = function () { // call function xpos x_pos = xpos(700,.20); with (bg) { _x += (x_pos - _x)*.4; } // call function xpos x_pos = xpos(950,.75); with (menu) { _x += (x_pos - _x)*.4; } }Now you’re finished! Test the movie.
现在您完成了! 测试电影。
Download the sample files here.
在此处下载示例文件 。
翻译自: https://www.sitepoint.com/menu-scrolling-background/
图片横线滚动脚本
相关资源:70款经典Dreamweaver插件