Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Action script 2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=49)
-   -   Animation (http://www.flasher.ru/forum/showthread.php?t=60261)

Linuxoid_Alex 06.07.2004 07:36

Animation
 
Люди, help, plz!!!
Как сделать анимированое построение прямоугольника?

Greben 06.07.2004 13:04

Очень грубо, но действенно :)
Код:

this.lineStyle(1, 0x000000, 100);
var targetX = 100;
var targetY = 0;
var tX = 0;
var tY = 0;
this.X0Y0X100Y0 = function() {
        if (tX<targetX) {
                this.lineTo(tX, targetY);
                this.moveTo(tX, targetY);
                tX += 5;
        } else {
                this.onEnterFrame = this.X100Y0X100Y100;
        }
};
this.X100Y0X100Y100 = function() {
        targetY = 100;
        if (tY<targetY) {
                this.lineTo(targetX, tY);
                this.moveTo(targetX, tY);
                tY += 5;
        } else {
                this.onEnterFrame = this.X100Y100X0Y100;
        }
};
this.X100Y100X0Y100 = function() {
        targetX = 0;
        if (tX>targetX) {
                this.lineTo(tX, targetY);
                this.moveTo(tX, targetY);
                tX -= 5;
        } else {
                this.onEnterFrame = this.X0Y100X0Y0;
        }
};
this.X0Y100X0Y0 = function() {
        targetY = 0;
        if (tY>=targetY) {
                this.lineTo(targetX, tY);
                this.moveTo(targetX, tY);
                tY -= 5;
        }
};
this.onEnterFrame = this.X0Y0X100Y0;

Я думаю без комментариев ;)

silin 06.07.2004 20:14

вариант
Код:

var h=200,w=300,step=5,i=0
lineStyle(3,0);
this.onEnterFrame=function(){
        i+=step;
        if(i<w)lineTo(i,0);
        if(i>=w&&i<w+h)lineTo(w,i-w);
        if(i>=w+h&&i<2*w+h)lineTo(2*w+h-i,h);
        if(i>=2*w+h)lineTo(0,2*(h+w)-i);
        if(i>=2*(w+h))delete this.onEnterFrame;
}


Елё 06.07.2004 20:44

И я! и я!
Вот:
Код:

#include "lmc_tween.as"

lineStyle(3,0);

var rc= this.createEmptyMovieClip("s",0);
function remove() {  rc.removeMovieClip(); }

rc.slideTo(200,0,2,undefined,0);
rc.slideTo(200,100,2,undefined,2);
rc.slideTo(0,100,2,undefined,4);
rc.slideTo(0,0,2,undefined,6,remove);
rc.onEnterFrame = function()
{
        this._parent.lineTo(this._x,this._y);
}


Linuxoid_Alex 07.07.2004 09:04

Thanks
А можно функцией всё это дело, причём как элемента класса?
Типа:
Код:

function Graph()
{
  ...
  this.AnimatePaintRectangle = function(x,y,w,h)
  {
    ...
  }
  ...
}
a = new Graph();
a.AnimatePaintRectangle(10,20,30,40);
a.AnimatePaintRectangle(20,30,40,50);
...


Linuxoid_Alex 07.07.2004 10:42

Цитата:

Оригинал написал(а) Елё
И я! и я!
Вот:
Код:

#include "lmc_tween.as"
...
}


Чё за lmc_tween.as?

Linuxoid_Alex 07.07.2004 12:00

Написал для просто построения, не как класса, а как класса функцию - не въезжаю...
Код:

this.h=0;
this.stepH=2;
this.x=100;
this.y=200;
this.maxH=100;
this.paintRect = function(x,y,w,h,clr)
{
        beginFill(clr);
        lineStyle(1,clr);
        moveTo(x,y);
        lineTo(x+w,y);
        lineTo(x+w,y-h);
        lineTo(x,y-h);
        lineTo(x,y);
        endFill();
}
this.onEnterFrame = function()
{
        if(h<maxH)
        {
                paintRect(x,y,10,h,0x3a6ea5);
                h+=stepH;
        }
}


Dindin 09.07.2004 00:22

Цитата:

Оригинал написал(а) Linuxoid_Alex

Чё за lmc_tween.as?

Movie Clip Tweening Prototypes
формат: mxi (Macromedia Extension)
размер: 155 904 байт
скачать: www.macromedia.com


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

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