![]() |
|
||||||||||
|
|||||
|
Guest
Сообщений: n/a
|
Создай любой мувик и
кадр 1 this._x=100 this._y=100 кадр 2 this._x=this._x+random(20)-10 this._y=this._y+random(20)-10 //интервал дрожания от -10 до +10 пкс |
|
|||||
|
2 Silense
Большое спасибо... ![]()
__________________
Идущий осилит дорогу! |
|
|||||
|
[+1.3 17.03.07]
Регистрация: Aug 2005
Сообщений: 18
|
Цитата:
Это теория, я так не делал, но мне кажется логически будет так. Я сам недавно начал флэшем заниматься |
|
|||||
|
Регистрация: Dec 2002
Адрес: Сочи
Сообщений: 2,819
|
Дрожите на здоровье.........
MovieClip.prototype.drog = function(amlituda, speed) { clearInterval(idd); var x = this._x; var y = this._y; var n = 0; var idd = setInterval(function (amlituda, trg) { if (n%2 == 0) { trg._x += 2*amlituda*Math.random()-amlituda; trg._y += 2*amlituda*Math.random()-amlituda; } else { trg._x = x; trg._y = y; } n++; updateAfterEvent(); }, 1000/speed, amlituda, this); }; mc.drog(2, 100); Последний раз редактировалось Штрек; 03.09.2005 в 05:16. |
|
|||||
|
Регистрация: Dec 2002
Адрес: Сочи
Сообщений: 2,819
|
Предвосхищая вопрос -
а как остановить? - чуть подправить - MovieClip.prototype.drog = function(amlituda, speed) { if (amlituda == undefined && speed == undefined) { clearInterval(this.idd); return; } clearInterval(this.idd); var x = this._x; var y = this._y; var n = 0; this.idd = setInterval(function (amlituda, trg) { if (n%2 == 0) { trg._x += 2*amlituda*Math.random()-amlituda; trg._y += 2*amlituda*Math.random()-amlituda; } else { trg._x = x; trg._y = y; } n++; updateAfterEvent(); }, 1000/speed, amlituda, this); }; mc.drog(2, 100); //останавливаем knopka.onPress = function() { mc.drog(); }; |
![]() |
![]() |
Часовой пояс GMT +4, время: 21:36. |
|
|
« Предыдущая тема | Следующая тема » |
|
|