原图效果

过渡效果

这个效果可以用帧动画实现较为简单,只需要调节这个影片剪辑的色彩效果样式里面的高级选项的三个通道值,以下用代码简单测试,可作为文档类:

 package
{
import com.tweener.transitions.Tweener;
import flash.display.Loader;
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.ColorTransform;
import flash.net.URLRequest;
/**
* ...
* @author FrostYen
*/ public class ColorTransformExample extends Sprite
{
private var ldr:Loader = new Loader();
private var sp:Sprite = new Sprite();
private var btn:Sprite = new Sprite();
private var colorTransform:ColorTransform = new ColorTransform(1, 1, 1, 1, 255, 255, 255, 0);
private var frame:int=15;//相当于影片剪辑动画的帧数
public function ColorTransformExample() {
ldr.load(new URLRequest("image/farewell-to-fall.jpg"));
sp.transform.colorTransform = colorTransform;
btn.graphics.beginFill(0x666666);
btn.graphics.drawRect(0, 0, 100, 50);
btn.graphics.endFill();
btn.buttonMode = true;
btn.x = 700;
btn.y = 100;
this.addChild(btn);
this.addChild(sp);
sp.addChild(ldr);
stage.frameRate = 36;//帧频 ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
btn.addEventListener(MouseEvent.CLICK, onClick);
} private function onClick(e:MouseEvent):void
{
addEventListener(Event.ENTER_FRAME, onEnter);
} private function onEnter(e:Event):void
{
if (colorTransform.redOffset > 0) {
colorTransform.redOffset -= 255/frame;
colorTransform.greenOffset -= 255/frame;
colorTransform.blueOffset -= 255/frame;
sp.transform.colorTransform = colorTransform;
}else {
colorTransform = new ColorTransform(1, 1, 1, 1, 255, 255, 255, 0);
removeEventListener(Event.ENTER_FRAME, onEnter);
}
} private function onImageLoaded(e:Event):void
{ }
}
}

[ActionScript 3.0] 利用ColorTransform实现对象(图片)的曝光过渡效果的更多相关文章

  1. [ActionScript 3.0] 通过BitmapData将对象保存成jpg图片

    此方法需要用到JPGEncoder.as和BitString.as这两个类,是将BitmapData对象转换成ByteArray,然后通过FileStream把此ByteArray写入到文件保存成jp ...

  2. [ActionScript 3.0] 利用InteractivePNG.as类精确选择识别png图片有像素的区域

    用法:如果是把png直接导入flash转换成影片剪辑,只需在影片剪辑属性中勾选为ActionScript导出(x),并把基类里的flash.display.MovieClip替换成Interactiv ...

  3. [ActionScript 3.0] AS3 用于拖动对象时一次一页的缓动

    package com.fylibs.components.effects{ import com.tweener.transitions.Tweener; import flash.display. ...

  4. [ActionScript 3.0] AS3 用于拖动对象时跟随鼠标的缓动效果

    package com.fylibs.components.effects { import flash.display.DisplayObject; import flash.events.Even ...

  5. [ActionScript 3.0] 如何获得实例对象的类名及类

    package { import flash.display.DisplayObject; import flash.display.MovieClip; import flash.display.S ...

  6. ActionScript 3.0 API 中的 Video 类

    注:这个类在Flash流媒体开发中使用的很频繁,在此记录一下它的使用方法. 包 flash.media 类 public class Video 继承 Video  DisplayObject  Ev ...

  7. [ActionScript 3.0] as3处理xml的功能和遍历节点

    as3比as2处理xml的功能增强了N倍,获取或遍历节点非常之方便,类似于json对像的处理方式. XML 的一个强大功能是它能够通过文本字符的线性字符串提供复杂的嵌套数据.将数据加载到 XML 对象 ...

  8. [ActionScript 3.0] 正则表达式

    正则表达式: 正则表达式最早是由数学家Stephen Kleene在对自然语言的递增研究成果的基础上,于1956提出来的.具有完整语法的正则表达式,主要使用在字符串的格式的匹配方面上,后来也逐渐应用到 ...

  9. ActionScript 3.0入门:Hello World、文件读写、数据存储(SharedObject)、与JS互调

    近期项目中可能要用到Flash存取数据,并与JS互调,所以就看了一下ActionScript 3.0,现把学习结果分享一下,希望对新手有帮助. 目录 ActionScript 3.0简介 Hello ...

随机推荐

  1. linux系统启动过程及运行等级详解

    一.启动过程 1. 开机流程简述 1)加载BIOS硬件信息,并获取第一个启动设备的代号 2)读取第一个启动设备的MBR的引导加载程序的启动信息 3)加载核心操作系统的核心信息,核心开始解压缩,并且尝试 ...

  2. 【小前端】float属性

    要求 需要float的元素,必须指定一个width宽度 没了 然后就可以指定 float:right 什么的了

  3. C程序之包含头文件

    在C程序中包含文件有以下两种方法: 方法一:#include<XXX.h> 这里的XXX一般是改动较小的标准库,用符号"<"和">"将要 ...

  4. go语言的特殊变量 iota

    iota,是go语言的特殊常量,可以认为是一个可以被编译器修改的常量. 在每一个const关键字出现时,被重置为0,然后在下一个const出现之前,每出现一次iota,其所代表的数字会自动增加1. 来 ...

  5. 4款最受欢迎的Mac原型工具

    原型工具中Wireframe, Mockup和prototype之间的有什么不同? 无论你是一名刚入行的UX/UI设计师,还是入行多年的老手,在制作原型的过程中一定接触或听说过其中很重要的三个原型术语 ...

  6. Part2_lesson2---ARM处理器工作模式

    arm公司发布的学习手册:ARM Architecture Reference Manual. 打开之: 找到Programmers' Model->A2.2 Processor modes. ...

  7. ngix 创建新的网站

    1. 进入ngix 的目录的conf 目录 的 vhosts 2. 复制一份新的v2.edc.com.conf 3. server_name : v2.edc.com root :  /ali/... ...

  8. TinyMCE3.x整合教程-Xproer.WordPaster

    版权所有 2009-2017 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webplug/wordpa ...

  9. Joomla3x-CKEditor4x-WordPaster整合示例

    1.1. 集成到Joomla_3.4.7-ckeditor4x 资源下载:Joomla 3x,   1.1.1. 添加wordpaster文件夹 路径:/media/wordpaster/   1.1 ...

  10. Alpha冲刺(五)

    Information: 队名:彳艮彳亍团队 组长博客:戳我进入 作业博客:班级博客本次作业的链接 Details: 组员1 柯奇豪 过去两天完成了哪些任务 基于ssm框架的前后端交互测试,结合微信小 ...