| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Chief Breaks-many-phones
Join Date: Jun 2007
Location: new york city
Posts: 527
|
I'm sure you've all seen those flash things where lines and swirling all over the place.. The go at angles, in and out of depths like you're racing along with it.. the curl and what not..
I'm looking to write some code to create lines like that.. Anyone interested in workin on it? I'll start up with some in a reply to this soon. |
|
|
|
|
|
#2 |
|
Chief Breaks-many-phones
Join Date: Jun 2007
Location: new york city
Posts: 527
|
Heres a quick rush of an example just to get the right idea in mind:
Just paste and it should do the trick. Code:
import flash.display.BitmapData
import flash.geom.Rectangle
with(_root){
lineStyle(1,0xFF0000,50);
beginFill(0x0,50);
moveTo(300,200);
lineTo(320,200);
lineTo(320,220);
lineTo(300,220);
lineTo(300,200);
endFill();
}
var bmp:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0x000000);
_root.attachBitmap(bmp,1);
_root.vx = 1
_root.vy = 0
onEnterFrame = function(){
bmp.draw(_root)
bmp.scroll(_root.vx,_root.vy)
}
var waiter = 0;
var currentTime = 0;
setInterval(
function(){
waiter++;
if(waiter==timesOfChange[currentTime].a){
_root.vx+= timesOfChange[currentTime].x;
_root.vy+= timesOfChange[currentTime].y;
waiter=0
currentTime++;
}
},100);
var timesOfChange = [
{a:10,x:1,y:2},
{a:5,x:1,y:-1},
{a:5,x:0,y:-2},
{a:5,x:-1,y:2},
{a:1,x:-1,y:2},
{a:1,x:-1,y:0},
{a:1,x:-1,y:1},
{a:1,x:-1,y:0},
{a:2,x:0,y:-1},
{a:3,x:0,y:-2},
{a:3,x:3,y:0},
{a:2,x:1,y:2},
{a:3,x:1,y:-1},
{a:5,x:0,y:-2},
{a:5,x:-1,y:0},
{a:1,x:-1,y:-1},
{a:2,x:-1,y:0},
{a:5,x:-1,y:1},
{a:2,x:-1,y:0},
{a:1,x:0,y:-1},
{a:2,x:0,y:-2},
{a:1,x:0,y:0}
]
|
|
|
|
|
|
|
|
|
#3 |
|
got as?
Join Date: May 2007
Posts: 507
|
i think it would be cool if var times of change was equivalent to xmouse and y mouse
|
|
|
|
|
|
#4 | |
|
Chief Breaks-many-phones
Join Date: Jun 2007
Location: new york city
Posts: 527
|
Quote:
My example was pretty crude, but its just that it can have some 3d feel to it, have the size and alpha of the object change to simulate depth and have it curve etc.. Most of those line animation things you see are videos imported, but I'd like to make a realtime vector animation class that simulates that. |
|
|
|
|
|
|
#5 |
|
got as?
Join Date: May 2007
Posts: 507
|
i meant it starts out moving the boxes to the right if your mouse is on the left it will curve around to the left then if you move it up it will curve up and start moving that way and if it gets to your mouse and you dont move the mouse it will curve around and come back to the mouse untill moved
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|