Flash AS3教程:创建好看的遮罩动画效果
作者 凌众技术
来源 网页制作
浏览
发布时间 2012-03-08
nbsp; this.scaleY = scale; } } } 这是一个名为MyMask.as的遮罩类,保存在fla文件的同一目录下。 8、切换到fla,在as层输入代码: //We use an array to hold all our masks. //(Except the mask that follows our cursor) var masks:Array = new Array(); //We add all of the masks to a container var maskContainer:Sprite = new Sprite(); //Set the maskContainer to be the image’s mask backgroundImage.mask = maskContainer; //Add the container on the stage addChild(maskContainer); //Create the mask which follows cursor movement (master mask) var masterMask:MyMask = new MyMask(1); //Set the master masks’s coordinates to match cursor’s coordinates masterMask.x = mouseX; masterMask.y = mouseY; //Add the master mask to a container maskContainer.addChild(masterMask); //Cache the image and container as bitmap, so we //can animate the alpha of the masks maskContainer.cacheAsBitmap=true; backgroundImage.cacheAsBitmap=true; //Create a timer that is called every 0.2 seconds var timer:Timer = new Timer(200,0); timer.addEventListener(TimerEvent.TIMER, timerEvent); timer.start(); //This function is called every 0.2 seconds. //We create a new mask in this function. function timerEvent(e:TimerEvent):void { & |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Flash AS3教程:创建好看的遮罩动画效果的所有评论