视频火烧特效组件

贴个摄像头视频的火烧的特效类。硬盘里翻到的。有了摄像头才翻到的,忘了哪里搞来的了, -_- !

 修改改了一下,这个是图片效果:

 

这个是Demo:

 


WebcamSpecially.as 代码:

class WebcamSpecially extends MovieClip
{
 var fireBmp, prevBmp, tempBmp, greyBmp, mtx, pnt, blurF, greyscaleCMF, fireCMF, dispMapF, webcam, fireBmpHolder, createEmptyMovieClip;
 var fps_pb, activityLevel_pb, wcGet, audioGet, sound_mc;
 function WebcamSpecially ()
 {
  super ();
  fireBmp = new flash.display.BitmapData (160, 120, false, 0);
  prevBmp = fireBmp.clone ();
  tempBmp = fireBmp.clone ();
  greyBmp = new flash.display.BitmapData (160, 120, false, 16743424);
  mtx = new flash.geom.Matrix ();
  pnt = new flash.geom.Point ();
  blurF = new flash.filters.BlurFilter (7, 7, 1);
  greyscaleCMF = new flash.filters.ColorMatrixFilter ([0.33, 0.33, 0.33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
  fireCMF = new flash.filters.ColorMatrixFilter ([0.8, 0.05, 0, 0, 0, 0, 0.65, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1, 0]);
  dispMapF = new flash.filters.DisplacementMapFilter (tempBmp, pnt, 1, 2, 7, - 35, "clamp");
  /////////////////////////////////////////////////////
 }
 function onLoad ()
 {
  fps_pb.setStyle ("fontSize", 10);
  fps_pb.setStyle ("themeColor", "haloOrange");
  fps_pb.labelPlacement = "top";
  fps_pb.mode = "manual";
  fps_pb.label = "FPS: %2 (%3%% dropped)";
  activityLevel_pb.setStyle ("fontSize", 10);
  activityLevel_pb.mode = "manual";
  activityLevel_pb.label = "Volume: %3%%";
  activityLevel_pb.setStyle ("themeColor", "haloGreen");
 }
 function configUI (_local2, _local1)
 {
  _local1.setUseEchoSuppression(true);
  wcGet = _local2;
  audioGet = _local1;
  webcam.vid.attachVideo (_local2);
  fireBmpHolder = this.createEmptyMovieClip ("fireBmpHolder", 1);
  fireBmpHolder.attachBitmap (fireBmp, 1, "always", false);
  fireBmpHolder.blendMode = "add";
  this.createEmptyMovieClip ("sound_mc", 5);
  sound_mc.attachAudio (_local1);
  _local1.onActivity = function (active)
  {
   if (active)
   {
    var haloTheme_str = "haloGreen";
   } else
   {
    var haloTheme_str = "0xFF0000";
   }
   activityLevel_pb.setStyle ("themeColor", haloTheme_str);
  };
 }
 function onEnterFrame ()
 {
  fps_pb.setProgress (wcGet.fps - wcGet.currentFps, wcGet.fps);
  activityLevel_pb.setProgress (audioGet.activityLevel, 100);
  tempBmp.copyPixels (prevBmp, prevBmp.rectangle, pnt);
  prevBmp.draw (webcam);
  if (tempBmp.getPixel (1, 1) < 2)
  {
   return (undefined);
  }
  tempBmp.draw (prevBmp, mtx, null, "difference");
  tempBmp.applyFilter (tempBmp, tempBmp.rectangle, pnt, greyscaleCMF);
  tempBmp.threshold (tempBmp, tempBmp.rectangle, pnt, ">", 1638400, 4289379174, 16711680, false);
  tempBmp.applyFilter (tempBmp, tempBmp.rectangle, pnt, blurF);
  fireBmp.draw (tempBmp, mtx, null, "add");
  tempBmp.perlinNoise (13, 10, 1, random (100) , false, true, 3, false);
  tempBmp.draw (greyBmp, mtx, null, "darken");
  fireBmp.applyFilter (fireBmp, fireBmp.rectangle, pnt, dispMapF);
  fireBmp.applyFilter (fireBmp, fireBmp.rectangle, pnt, fireCMF);
 }
 static var CLASS_REF = WebcamSpecially;
 static var LINKAGE_ID = "WebcamSpecially";
}

 具体的使用方法看 Demo 文件,这里下载 




[本日志由 jack 于 2006-08-20 11:49 PM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 视频 特效 组件
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.