Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript (http://www.flasher.ru/forum/forumdisplay.php?f=5)
-   -   ФЕЕРВЕРК И СНЕГ (http://www.flasher.ru/forum/showthread.php?t=53159)

dddimka 27.12.2003 02:00

ФЕЕРВЕРК И СНЕГ
 
здороваа всем, люди добрые напишите подсказку как сделать что-то в этом стиле...

1.ФЕЕРВЕРК - чтоб что-то разлеталось в разные стороны...и исчезало...

2.СНЕГ - который остается на чем-либо - буквах например...

sergwizard 27.12.2003 04:28

1. Подсказкой здесь не отделаешься. Лучше вот что, - помести этот код в первый фрейм. Только сделай fps побольше, где-то 24-30. "Это" будет и разлетаться, и исчезать. А ты будешь наслаждаться.
Код:

this.createEmptyMovieClip("sky", ++depth)
with (sky) {
        beginFill(0x000033)
        lineTo(550,0); lineTo(550,400); lineTo(0,400)
        endFill()
}
getC = function (r, g, b) {
        return r<<16 | g<<8 | b;
}

_root.sky.onEnterFrame = function () {
        if (depth>10000) depth=500;
}

Math.PI2 = 180/Math.PI;
_root.sky.createEmptyMovieClip("fw", ++depth);
_root.sky.fw.lineStyle(0, 0xFF0000, 100);
_root.sky.fw._y = 350; _root.sky.fw._yscale = -100;
_root.sky.fw.onEnterFrame = function() {
        if (Math.random()<0.02) _root.makeFirework();
}
function makeFirework() {
        sx = Math.random()*450+50; sy = 0;
        ex = Math.random()*450+50; ey = Math.random()*100+200;
        dx = ex - sx; dy = ey - sy; d = Math.sqrt(dx*dx + dy*dy);
        _root.sky.fw.createEmptyMovieClip("f"+depth, ++depth);
        n = _root.sky.fw["f"+depth];
        n._x = sx; n._y = sy; n.ex = ex; n.ey = ey; n.len = d;
        r = Math.random()*100+100; g = Math.random()*100+100; b = Math.random()*100+100;
        klop = Math.random();
        if (klop<0.3333)                r = Math.random()*55+200;
        else if (klop<0.6666)        g = Math.random()*55+200;
        else                                        b = Math.random()*55+200;
        n.rgb = getC(Math.round(r), Math.round(g), Math.round(b));
        r -= Math.random()*30; g -= Math.random()*30; b -= Math.random()*30;
        n.rgb2 = getC(Math.round(r), Math.round(g), Math.round(b));
        n._rotation = Math.PI2*Math.atan2(dy, dx)-90;
        n.mode = 1; n.step=0;
        n.onEnterFrame = function () {
                if (this.mode==1) {
                        if (this.step<10) {
                                this.createEmptyMovieClip("p"+this.step, ++depth);
                                this.n = this["p"+this.step];
                                this.l = this.len*(Math.sin((Math.PI/2)/10*(this.step+1)) - Math.sin((Math.PI/2)/10*this.step));
                                this.n.lineStyle(random(5), this.rgb, 100);
                                this.n.curveTo(-this.l/5, this.l/4, 0, this.l/2); this.n.curveTo(this.l/5, 3*(this.l/4), 0, this.l);
                                this.n._y = this.len * Math.sin((Math.PI/2)/10*this.step);
                                this.n.onEnterFrame = function() {
                                        this._alpha -= 20; this._xscale -= 20;
                                        if (this._alpha<5) this.removeMovieClip();
                                }
                        }
                        if (this.step==15) {
                                this.step = 0; this.mode = 2;
                                this._rotation = 0; this._x = this.ex; this._y = this.ey;
                        }
                } else if (this.mode==2) {
                        for (i=0; i<20; i++) {
                                this.createEmptyMovieClip("fa"+(i+this.step*30), ++depth);
                                this.n = this["fa"+(i+this.step*30)];
                                this.n._rotation = Math.random()*360;
                                this.n.onEnterFrame = function() {
                                        this.step++;
                                        this._y -= this.step*0.2;
                                        if (this.step==20) this.removeMovieClip();
                                }
                                this.n.createEmptyMovieClip("fb", ++depth);
                                this.n = this.n["fb"];
                                this.n._y = 10*Math.random();
                                this.n.lineStyle();
                                if (Math.random()<0.2) this.n.beginFill(this.n._parent._parent.rgb2, 100);
                                        else this.n.beginFill(this.n._parent._parent.rgb, 100);
                                this.n.curveTo(-3, 3, 0, 7); this.n.curveTo(3, 3, 0, 0); this.n.endFill();
                                this.n.k = Math.random()*0.7+0.3;
                                this.n.c = new Color(this.n);
                                this.n.c.setTransform({ab:-255});
                                this.n.onEnterFrame = function() {
                                        this.step++;
                                        if (this.step<=8) {
                                                klop = (this.step+1)/9;
                                                this.c.setTransform({rb:255*klop, gb:-100*klop, bb:-255*klop, ab:-255*(1-klop)});
                                                this._y += this.k*8*Math.sin((Math.PI/2)/20*(12+this.step))
                                        } else {
                                                this._y += this.k*8*Math.sin(Math.PI/2+(Math.PI/2)/20*(this.step));
                                                klop = 1-(this.step-8)/12;
                                                this.c.setTransform({rb:255*klop, gb:-100*klop, bb:-255*klop, ab:-255*(1-klop)});
                                        }
                                }
                        }
                        if (this.step==5) { this.step = 0; this.mode = 3; }
                } else if (this.mode==3 && this.step==30) {
                        this.removeMovieClip();
                }
                this.step++;
        }
}

2. Зайди на топик http://www.flasher.ru/forum/showthre...4&pagenumber=1

а)Посмотри, как Nox Noctis сотворил снег.
б)Поменяй его направление и увеличь частоту снежинок.
в)На поверхность, на которую падает снег, помести клип – белая шапка с _yscale = 0. При попадании снежинок на этот клип, увеличивай _yscale шапки.

Штрек 27.12.2003 16:19

Вложений: 1
По снегу глянь исходник - падает, липнет,
подтаивает :D
sergwizard - ну как тебе Винни Пух?
Чего молчишь?

sergwizard 27.12.2003 16:28

Привет, Штрек. Винни Пух - замечательный! :)
Я бы тоже поучаствовал в этом проекте, если бы он не был для Flash 2004, и если бы у меня было время.

Штрек 27.12.2003 20:25

Вставил БАБУ ЯГУ, которая ворует снежинки.
Зайди, глянь. :p


Часовой пояс GMT +4, время: 18:50.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.