TweenMax sample code

来源:互联网 发布:顶级域名有几种类型 编辑:程序博客网 时间:2024/04/29 09:13
//import the GreenSock classesimport com.greensock.*;import com.greensock.easing.*; //tween the MovieClip named "mc" to an alpha of 0.5 over the course of 3 secondsTweenMax.to(mc, 3, {alpha:0.5}); //scale myButton to 150% (scaleX/scaleY of 1.5) using the Elastic.easeOut ease for 2 secondsTweenMax.to(myButton, 2, {scaleX:1.5, scaleY:1.5, ease:Elastic.easeOut}); //tween mc3 in FROM 100 pixels above wherever it is now, and an alpha of 0. (notice the vars object defines the starting values instead of the ending values)TweenMax.from(mc3, 1, {y:"-100", alpha:0}); //tween mc4 from x:100 to x:300 while changing its tint from whatever it is when the tween starts to red (0xFF0000)TweenMax.fromTo(mc4, 1, {x:100}, {x:300, tint:0xFF0000}); //after a delay of 3 seconds, tween mc for 5 seconds, sliding it across the screen by changing its "x" property to 300, using the Back.easeOut ease to make it shoot past it and come back, and then call the onFinishTween() function, passing two parameters: 5 and mcTweenMax.to(mc, 5, {delay:3, x:300, ease:Back.easeOut, onComplete:onFinishTween, onCompleteParams:[5, mc]});function onFinishTween(param1:Number, param2:MovieClip):void {    trace("The tween has finished! param1 = " + param1 + ", and param2 = " + param2);} //call myFunction() after 2 seconds, passing 1 parameter: "myParam"TweenMax.delayedCall(2, myFunction, ["myParam"]); //tween every MovieClip in the "letters" Array up 100 pixels (changing their "y" property to a relative value of "-100") over 2 seconds while fading out, and stagger the start time of each tween by 0.1 seconds. There could literally be hundreds of MovieClips in the "letters" Array and this one line of code would tween them all!TweenMax.allTo(letters, 2, {y:"-100", alpha:0}, 0.1); //use the object-oriented syntax to create a TweenMax instance and store it so we can reverse, restart, or pause it later. Make it repeat twice with a 1-second delay between each repeat cycle.var myTween:TweenMax = new TweenMax(mc2, 3, {y:200, repeat:2, repeatDelay:1, onComplete:myFunction}); //some time later (maybe in by a ROLL_OUT event handler for a button), reverse the tween, causing it to go backwards to its beginning from wherever it is now.myTween.reverse(); //pause the tweenmyTween.pause(); //restart the tweenmyTween.restart(); //make the tween jump to its halfway pointmyTween.currentProgress = 0.5;

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 骨滑液通过皮肤渗透怎么办 水银弄眼睛里怎么办 手上沾了水银怎么办 碘化汞皮肤中毒怎么办 农药引起皮肤痒怎么办 农药渗入皮肤痛怎么办 被别人下毒了怎么办 担心被别人下毒怎么办 天龙八部北冥真气洗掉了怎么办 vivox6关不了机怎么办 vivoy85开不了机怎么办 vivoy55死机卡屏怎么办 ⅴivo手机死机怎么办 vivo卡死机了怎么办 秒玩登录失败怎么办 一体机卡糟卡住怎么办 台式一体机卡了怎么办 一体机有点卡卡怎么办 DNF拼图拼错了怎么办 p图照片有竖条怎么办 qq提示连接超时怎么办 苹果app涉赌怎么办 棋牌app涉赌怎么办 打闲来麻将老输怎么办 儿子欠老子钱不还怎么办 傲风电竞椅扶手坏了怎么办 桑蚕丝面料发黄了怎么办? 天然植物纤维面料发黄怎么办 阴阳师吸血姬血太厚了怎么办 电话被骗了钱怎么办 镇魔曲元宝被扣怎么办 镇魔曲以前的角色怎么办 镇魔曲手游转职后装备怎么办 镇魔曲个性标签任务怎么办 教师资格证申请表打不开怎么办 怎么办appstore换到日本 电脑内存太小怎么办 win10声音卡顿怎么办 录音播放卡顿怎么办 笔记本电脑玩dnf卡怎么办 龙之谷约惠码被删了怎么办