[flash]拉覇效果的banner partII

LINEで送る
[`evernote` not found]

第一版會當掉的問題應該是flash的tween的問題了
今天google了一下換tweener來試了一下
目前是沒有發生同樣的情形
不愧是高手高高手開發的東西阿

tweener還提供許多動態路線可以使用(這邊也有)
能做的當然也不只位移
模糊 大小 比例 透明 顏色….都可以
不過有的要先初始化才能控制到
像是要控制BLUR的話要先FilterShortcuts.init()
要控制COLOR的話要先ColorShortcuts.init()
不過每初始化一樣都會增加SWF的大小
可以參考節自官網的下表

Class path and nameDescriptionApproximate addition to SWF size
caurina.transitions.properties.ColorShortcutsIncludes properties for manipulating the color of display objects, such as individual channel multiplier and offsets, and special coloring such as hue, saturation, brightness and contrast.2.2 kb
caurina.transitions.properties.CurveModifiersModifiers that provide some kind of change for normal tweenings; right now, the bezier curve only.0.4 kb
caurina.transitions.properties.DisplayShortcutsSpecial properties for display objects such as Sprites, MovieClips, and TextField instances, include modifiers for visibility, frame position, and scrollRect size.0.8 kb
caurina.transitions.properties.FilterShortcutsA list of special properties that simplify the tweening of the built-in bitmap filters such as Blur, Glow, and many others.3.5 kb
caurina.transitions.properties.SoundShortcutsSpecial properties used when controlling sound.0.2 kb
caurina.transitions.properties.TextShortcutsAdditional special properties used to change some specific TextField properties, such as TextFormat properties, and the text content itself.0.9 kb

還有一個很方便的是它連EventListener也內建了
很容易就可以呼叫下一個動作並帶入參數
加上延遲的時間
很直覺性的可以做出希望完成的動作~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();
stage.frameRate =30;
 
var blurMax:Number = 64;
var loopMax:Number = 3;
var stopArr :Array = new Array("",-142,-99,-51,0);
var atArr :Array = new Array("","44444","33333","22222","11111");
var newgoAt:Number;
function init():void {
	for (var i=1; i<=5; i++) {
		var tmc:MovieClip = this["mov"+i+"_mc"];
		tmc.gotoAndStop(i);
	}
	movebar();
	newgoAt = 1;
	var playbar = setInterval(movebar , 6000);
}
 
 
function movebar():void {
	newgoAt ++;
	newgoAt = newgoAt >4? 1:newgoAt;
	for (var i=1; i<=5; i++) {
		var tmc:MovieClip = this["mov"+i+"_mc"];
		tmc.looptime = 0;
		setTimeout(next1,300*i,tmc);
	}
}
 
function next1(m:MovieClip):void {
	Tweener.addTween(m, {y:100, time:1, transition:"easeInQuint", onComplete:next2,onCompleteParams:[m]});
	Tweener.addTween(m, {_Blur_blurY:4, time:2.5, transition:"easeInQuint", onComplete:next2,onCompleteParams:[m]});
}
function next2(m:MovieClip) {
	m.y = -140;
	if(m.looptime<loopMax){
		m.looptime++;
		Tweener.addTween(m, {y:150, time:0.5, transition:"linear"});
		Tweener.addTween(m, {_Blur_blurY:blurMax, time:0.5, transition:"linear", onComplete:next2,onCompleteParams:[m]});
	}else{
		next3(m);
	}
}
 
function next3(m:MovieClip) {
	var num:Number = int(m.name.substr(3,1))-1;
	var stopAt:Number = stopArr[atArr[newgoAt].substr(num,1)];
	m.y = stopAt-150;
	Tweener.addTween(m, {y:stopAt, time:0.5, transition:"easeOutExpo"});
	Tweener.addTween(m, {_Blur_blurY:0, time:0.5, transition:"easeOutExpo"});
}
 
init();

改用tweener後程式碼感覺也簡單多了~

141 則迴響於《[flash]拉覇效果的banner partII

  1. 版主~你好~~
    請問可以跟你要原始檔嗎??
    我覺得版主做的非常細緻
    不會有BUG的感覺
    非常感謝版主^^
    (sab_121209@yahoo.com.tw)

  2. 版主您好,看到您的拉霸效果覺得非常有質感,

    不知道是否方便提供原始檔研究研究呢,感謝喔!

  3. 版主 您好~~
    最近公司上要製作此類型的遊戲
    可否請您寄這個範例讓我學習一下呢?
    非常感謝!

  4. 版主 你好~~
    這個範例超棒的~
    我最近也在學習中~
    也可以寄範例讓我學習~~
    非常感謝!!!!!!!!!

  5. 跪求 T^T
    之前找到的都是Random,
    非常需要這個效果。謝謝!
    電郵根據填寫那個不會公開的。
    謝謝!

回應已關閉。