free Learning design - Photoshop - 3D Max - Swish Max - Maya - Cinema 4D - Blender - anime Por Stidio

Sunday, November 25, 2012

Swishmax 4 Fireworks Tutorial Using Color Matrix Filter



First Of All
Open SwishMax 4 set your movie properties to
Black Background.
width = 500
Height = 450
Frame Rate = 35.

here is an animated gif of a firework which we will be using in ths tutorial.
save this to your project folder, right click | save as.

once you have saved the firework gif to your hard drive we need to import it to the stage of our swishmax 4 movie.
click File | Import to stage| Animation, select gif and import.
once imported you will see a new movieclip has apeared firework_gif rename this to firework.

you will need to add 15 frames infront of the original frame 1
right click on the firework timeline and insert frame(s)

if some are struggling to understand this, or how to do it, download the sample file below.
http://www.swish-designs.co.uk/blog/wp-content/plugins/downloads-manager/img/icons/ico_excel.gifdownload: Sample1 swishmax 4 firework tutorial (363.07KB)
added: 04/11/2010
clicks: 1357
description: only download this file if you are struggling to add the 15 new frames in front of the original frame 1. this file only containes the added 15 frames and the imported firewok gif. 
now add the following code to the firework movieclip.
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
onSelfEvent (enterFrame) {
    ran=random(70);
    scaleit=randomRange(50,150);
    if (ran=="7" && playing=="false") {
        this.play();
        this._x=randomRange(70,400);
        this._y=randomRange(70,350);
        this._yscale=scaleit;
        this._xscale=_yscale;
    }
}
onSelfEvent (load) {
    playing="false";
}
onFrame (16) {
    playing="false";
}
onFrame (16) {
    stop();
}
onFrame (17) {
    setLabel("play");
    playing="true";
}
onFrame (126) {
    gotoAndPlay(1);
}
onFrame (127) {
    stop();
}
onFrame (2) {
    ranc=random(4);
}
onFrame (7) {
    if (ranc==0) {
        _parent.control.gotoAndPlay("blue");
    }
    else if (ranc==1) {
        _parent.control.gotoAndPlay("pink");
    }
    else if (ranc==2) {
        _parent.control.gotoAndPlay("green");
    }
    else if (ranc==3) {
        _parent.control.gotoAndPlay("yellow");
    }
}
it should now play like the movie shown below when you press Ctrl+T (test in player)
Ok. so now we need to create a new empty movieclip and name it control.

now add the following code to it.
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
onFrame (1) {
    stop();
}
onFrame (2) {
    setLabel("blue");
}
onFrame (3) {
    myFilter = new flash.filters.ColorMatrixFilter ();
    myFilter.matrix = new Array
    (0,0,0,0,0, 0,1,0,0,0, 0,0,2,0,0, 0,0,0,1,0);
    // | red | green | blue | alpha
    _parent.firework.filters = [myFilter];
}
onFrame (4) {
    stop();
}
onFrame (5) {
    setLabel("pink");
}
onFrame (6) {
    myFilter = new flash.filters.ColorMatrixFilter ();
    myFilter.matrix = new Array
    (2,0,0,0,0, 0,1,0,0,0, 0,0,2,0,0, 0,0,0,1,0);
    // | red | green | blue | alpha
    _parent.firework.filters = [myFilter];
}
onFrame (7) {
    stop();
}
onFrame (8) {
    setLabel("green");
}
onFrame (9) {
    myFilter = new flash.filters.ColorMatrixFilter ();
    myFilter.matrix = new Array
    (0,0,0,0,0, 0,1,0,0,0, 0,0,0,0,0, 0,0,0,1,0);
    // | red | green | blue | alpha
    _parent.firework.filters = [myFilter];
}
onFrame (10) {
    stop();
}
onFrame (11) {
    setLabel("yellow");
}
onFrame (12) {
    myFilter = new flash.filters.ColorMatrixFilter ();
    myFilter.matrix = new Array
    (0,0,0,5,1, 2,0,0,0,1, 0,0,1,0,1, 0,0,0,1,0);
    // | red | green | blue | alpha
    _parent.firework.filters = [myFilter];
}
onFrame (13) {
    stop();
}
when you have done that, group the firework movie clip and the control movieclip together as a new movieclip ad name it firework.
now add the following code to Scene_1

1
2
3
4
5
6
7
onSelfEvent (load) {
    for (i=0; i<3; i++) {
        for (j=0; j<5; j++) {
            duplicateMovieClip( "_root.firework", "firework"+(i+50*j), i+50*j );
        }
    }
}
thats it press Ctrl+T (test in player) you should have a working display something like below.
you can add more colours by playing with the matrix colour filter settings.

0 التعليقات:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by zakaria m. mnefi زكريا مصطفى منيفي