Flash CS4中"将动画复制为ActionScript"使用初探
来源:互联网 发布:mac 显示.gitignore 编辑:程序博客网 时间:2024/06/05 18:05
刚开始用CS4的时候就注意到了这个这个功能不过都没实践过,这几天实践了一下发现是个很好很和谐的的技能 .有了它我们就可以很傻瓜的编辑一些我们程序员很头疼的代码,比如flash动画的滤镜效果,如果没有这个功能估计帮助文档里面的flash.filters包得看半天…有个这个功能我们就不用愁了.比如现在我想动态添加添加一个元件的模糊效果.
首先我们在时间轴的第一帧放一个元件,然后在后面的时间轴比如第十帧右击插入帧,再右击创建补间动画(不是传统补间哦)接下来打开动画编辑器点击滤镜->模糊分别在实践轴的第一(我都设置为100)和末位帧(我都设置0)设置元件的x模糊值和y模糊值,按下Enter就可以发现是一个从模糊到清晰地渐变效果,我把自己的动画效果代码贴出来:
1: import fl.motion.AnimatorFactory;
2: import fl.motion.MotionBase;
3: import flash.filters.*;
4: import flash.geom.Point;
5: var __motion_元件2_3:MotionBase;
6: if(__motion_元件2_3 == null) {
7: import fl.motion.Motion;
8: __motion_元件2_3 = new Motion();
9: __motion_元件2_3.duration = 10;
10:
11: // Call overrideTargetTransform to prevent the scale, skew,
12: // or rotation values from being made relative to the target
13: // object's original transform.
14: // __motion_元件2_3.overrideTargetTransform();
15:
16: // The following calls to addPropertyArray assign data values
17: // for each tweened property. There is one value in the Array
18: // for every frame in the tween, or fewer if the last value
19: // remains the same for the rest of the frames.
20: __motion_元件2_3.addPropertyArray("x", [0]);
21: __motion_元件2_3.addPropertyArray("y", [0]);
22: __motion_元件2_3.addPropertyArray("scaleX", [1.000000]);
23: __motion_元件2_3.addPropertyArray("scaleY", [1.000000]);
24: __motion_元件2_3.addPropertyArray("skewX", [0]);
25: __motion_元件2_3.addPropertyArray("skewY", [0]);
26: __motion_元件2_3.addPropertyArray("rotationConcat", [0]);
27: __motion_元件2_3.addPropertyArray("blendMode", ["normal"]);
28:
29: // This call to initFilters supplies the Motion with an Array
30: // of the fully-qualified class names of the filters in the
31: // target's DisplayObject.filters list, in the same order and
32: // indices.
33: __motion_元件2_3.initFilters(["flash.filters.BlurFilter"], [0], -1, -1);
34:
35: // The following calls to addFilterPropertyArray assign data
36: // values for each tweened filter's properties.
37: __motion_元件2_3.addFilterPropertyArray(0, "blurX", [53,47.1111,41.2222,35.3333,29.4445,23.5556,17.6667,11.7778,5.88889,0], -1, -1);
38: __motion_元件2_3.addFilterPropertyArray(0, "blurY", [48,42.6667,37.3333,32,26.6667,21.3333,16,10.6667,5.33334,0], -1, -1);
39: __motion_元件2_3.addFilterPropertyArray(0, "quality", [BitmapFilterQuality.LOW], -1, -1);
40:
41: // Create an AnimatorFactory instance, which will manage
42: // targets for its corresponding Motion.
43: var __animFactory_元件2_3:AnimatorFactory = new AnimatorFactory(__motion_元件2_3);
44: __animFactory_元件2_3.transformationPoint = new Point(0.500000, 0.500000);
45:
46: // Call the addTarget function on the AnimatorFactory
47: // instance to target a DisplayObject with this Motion.
48: // The second parameter is the number of times the animation
49: // will play - the default value of 0 means it will loop.
50: // __animFactory_元件2_3.addTarget(, 0);
51: }
那么怎么把这段代码用起来呢,注意到了最后一句洋文么,大意就是讲需要此动画的实例名字写在第一个参数里,第二个是动画循环次数,0表示无限循环;
好了我们可以写一段代码来测试下:
1: var motionTest:Sprite = new Sprite();
2:
3: //画一个三角形
4: motionTest.graphics.beginFill(0x000000)
5: motionTest.graphics.moveTo(50,0);
6: motionTest.graphics.lineTo(0,100);
7: motionTest.graphics.lineTo(100,100);
8: addChild(motionTest);
9:
10: //应用动画
11: __animFactory_元件2_3.addTarget(motionTest, 2);
我们可以发现运行后将会在左上角出现一个黑色三角形,并且这个三角形模糊渐渐两次;
- Flash CS4中"将动画复制为ActionScript"使用初探
- 在Flash CS4中使用Flex元数据标签
- Create real water effects with Flash CS4 & ActionScript 3.0
- 使用FLEX和Actionscript开发FLASH 游戏-位图动画
- Flash动画学习指导十一:使用ActionScript 3
- Flash CS4网页中Flash背景透明
- C# 的时间戳 在flash actionscript中使用
- DW CS4 插入FLASH 使用透明背景
- 如何将flash动画用到PPT中
- Create Cool Line Effects using Actionscript 3.0 in Flash CS4 or Flex Builder 3
- 在PowerPoint中FLASH动画的使用
- Flash cs4 外部文本文件加载,库中影片剪辑加载
- Flash builder中mxml与actionscript关系
- Flash ActionScript中变量后定义问题
- 使用Flex和Actionscript开发Flash游戏
- Flash CS4新增功能
- Flash CS4 Professional Bible
- Flash cs4序列号
- :_现实再美゛.也美不过虚伪゜
- 流氓的格调网——删除系统垃圾
- 定时反复执行某一个任务
- C++ 重写了一个学生管理程序(作业题)
- Windows7中的“上帝模式”
- Flash CS4中"将动画复制为ActionScript"使用初探
- Windows7下安装VC2008绿色版
- 2010考研小记
- null,""以及" "的区别
- ubuntu常用命令
- Error: mx.styles::IStyleManager2'. 解决方法
- Java学习源代码
- java oracle存储过程/函数(1):字符串数组、int数组传入存储过程
- PKM2数据导出的xml显示用的XSL