`
hereson
  • 浏览: 1428050 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

写了一个Flash的Transition

阅读更多

写了一个Flash的Transition

 package
{
import flash.display.*;
import flash.geom.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import fl.motion.BezierSegment;
 
 
public class MarsFly extends Transition
{
 private var _origin_x:Number;
 private var _origin_y:Number;
 private var _origin_zoom:Number;
 private var _origin_alpha:Number;
 private var _start_x:Number = 0;
 private var _start_y:Number = 0;
 private var _control_x:Number = 0;
 private var _control_y:Number = 0;
 private var _start_zoom:Number = 2.5;
 private var _start_alpha:Number = 0;
 private var _bezier:BezierSegment;
 
    /**
     * @private
     */
 override public function get type():Class
 {
  return MarsFly;
 }
 
 
 
    /**
     * @private
  * @param transParams - 参数zoom,alpha,x 起始点x,y 起始点y,cx 控制点x,cy 控制点y
     */
 function MarsFly (content:MovieClip, transParams:Object, manager:TransitionManager)
 {
  super(content, transParams, manager);
  _origin_x = this.manager.contentAppearance.x;
  _origin_y = this.manager.contentAppearance.y;
  _origin_zoom = this.manager.contentAppearance.scaleX;
  _origin_alpha = this.manager.contentAppearance.alpha;
  _start_x = (transParams.x)?transParams.x:0;
  _start_y = (transParams.y)?transParams.y:0;
  _start_zoom = (transParams.zoom)?transParams.zoom:2.5;
  _start_alpha = (transParams.alpha)?transParams.alpha:0;
  _control_x = transParams.cx;
  _control_y = transParams.cy;
 
  _bezier = new BezierSegment(new Point(_start_x, _start_y),
         new Point(_start_x, _start_y),
         new Point(_control_x, _control_y),
         new Point(_origin_x, _origin_y)
         );
 }
 
    /**
     * @private
     */    
 override protected function _render(p:Number):void
 {
  var point:Point = this._bezier.getValue(p);
  this._content.x = point.x;//this._start_x + (this._origin_x - this._start_x) * (Math.sin(p*Math.PI/2));
  this._content.y = point.y;//this._start_y + (this._origin_y - this._start_y) * (Math.cos((1-p)*Math.PI/2));
  this._content.alpha = this._start_alpha + (this._origin_alpha - this._start_alpha) *p;
  this._content.scaleX = this._content.scaleY = this._start_zoom + (this._origin_zoom - this._start_zoom) *p;
 }
 
}
 
 
 
}

调用时

import fl.transitions.*;
import fl.transitions.easing.*;
 
btn1.addEventListener(MouseEvent.CLICK, function (event){
TransitionManager.start(img1_mc, {type:MarsFly, direction:Transition.OUT, duration:2, easing:Strong.easeOut, x:300,y:300, cx:300, cy: 0,zoom:5,alpha:0.1});               
              });
 
btn2.addEventListener(MouseEvent.CLICK, function (event){
TransitionManager.start(img1_mc, {type:MarsFly, direction:Transition.IN, duration:2, easing:Strong.easeOut,x:300,y:300, cx:300, cy: 0,zoom:0.1,alpha:0});                           });

 

分享到:
评论

相关推荐

    Flash Transition

    Flash transition effect.

    [Flash.ActionScript.3.0动画教程]

    [Flash.ActionScript.3.0动画教程]

    velocity.zip

    Bootstrap弹窗动画效果组件:velocity,使用方法:$("#" + modalId + " .modal-dialog").velocity("特效名称"); //特效类型: //transition.fadeIn //transition.flipXIn、... //callout.flash //callout.pulse

    CSS3中Animation属性的使用详解

    前面我们在使用transition制作一个简单的transition效果时,我们包括了初始属性和最终属性,一个开始执行动作时间和一个延续动作时间以及动作的变换速率,其实这些值都是一个中间值,如果我们要控制的更细一些,比如...

    Foundation XML and E4X for Flash and Flex

    Whether you are a designer or developer, this book will help you work with XML and make the transition from ActionScript 2.0 to ActionScript 3.0. It will also provide you with an excellent grounding ...

    ember-flash-message-2000:Ember Flash 消息的 ES6 包装器

    这是一个插件,可以使用安装: npm install --save-dev ember-flash-message-2000 演示 你可以在这里看到基本的虚拟应用程序: 基本API {{ flash-messages }} // From within a route, controller, or ...

    超炫JS代码,如同flash的图片轮换

    实现flash效果 var currslid = 0; var slidint; function setfoc(id){ document.getElementById("focpic").src = picarry[id]; document.getElementById("foclnk").href = lnkarry[id]; document.getElementById...

    YUGLTransition效果的库

    YUGLTransition效果的库源码,源码YUGLTransition,YUGLTransition是一个可以为UIView和UIViewController创建基于GPU过渡效果的库。YUGLTransition渲染部分使用了GPUImage。YUGLTransition包含一些现成的过渡效果,...

    dreamweaver上PHP网站开发相关插件

    在你的网页里面插入一个层,并且在这个层里面导入另一个页面的URL。 Transition.mxp 设置网页背景转换效果 Save Password Login form.mxp 保留登陆的姓名和密码,并且可以为其设置保留时间。 Scrolling Status ...

    Almediadev.All.in.On

    With SmartFlash you can create flash interface in your applications (flash forms, menus, controls and more). SmartFlash is intended for use with: Delphi 2009, 2010, XE, XE2, XE3, XE4 C++Builder ...

    PHP动态网站开发插件

    在你的网页里面插入一个层,并且在这个层里面导入另一个页面的URL。 Transition.mxp 设置网页背景转换效果 Save Password Login form.mxp Download 点击下载 保留登陆的姓名和密码,并且可以为其设置保留时间。 ...

    flex3的cookbook书籍完整版dpf(包含目录)

    如何在一个表单内通过ToolTips来返映一个错误 15.7节. 如何使用正则表达式去定位电邮地址 15.8节. 如何使用正则表达式去验证信用卡号码 15.9节. 如何使用正则表达式来验证ISBN号 15.10节. 如何通过指定字符类...

    英文原版-Laszlo in Action 1st Edition

    Laszlo in Action is the first comprehensive guide to the Laszlo system and its language LZX.... The dramatic emergence of Ajax over the past year was a first step in the transition from page-oriented ...

    The Essential Guide to Flex 2 with ActionScript 3.0 源代码

    * Learn how states can smoothly transition your application interfaces between different data displays. Put quite simply, this book is all youll need to master Flex 2 and ActionScript 3.0 application...

    video-transitions

    WebGL视频过渡这是一个使用在两个不同的视频剪辑之间生成实时过渡效果的示例。转场鞭Pan 在古老的功夫电影和( 和( 的作品中都曾见过。 通常是在相机中完成的,但这是伪造的版本。 在应用较大的方向模糊时,两个...

    web 视频播放器 js

    fsbuttonlink (url):如果用户的flashplayer版本高于(9.0.28)播放器会自动的显示一个全屏按钮。通过设置该值,你可以链接到另外的页面用以全屏显示。服务端程可以设定将要播放的文件。 id (string): 播放器的唯一...

    The Essential Guide to Flex 2 with ActionScript 3.0-part 1

    Connect Flex to Adobe's powerful ColdFusion application server, and start to work with Flex applications powered by dynamic server-side code. * Learn how states can smoothly transition your ...

    The Essential Guide to Flex 2 with ActionScript 3.0-part 2

    Connect Flex to Adobe's powerful ColdFusion application server, and start to work with Flex applications powered by dynamic server-side code. * Learn how states can smoothly transition your ...

    GetWebPics专业版2.9

    Build-in picture viewer, thumbnail viewer and fullscreen slideshow with transition effects will help you to preview and manage pictures (copy, print, set as wallpaper, send by e-mail, etc.). ...

    transitionable-routes:使用React Router更改路线时执行过渡

    在某个时间点,这可以通过但是在某个时候,React Router遇到了重大障碍,破坏了与它的集成,而作为一种解决方法,react-transition-group团队以一种对我来说是降级,因为它们很难使事情变得可定制(它们添加了一个对...

Global site tag (gtag.js) - Google Analytics