View Full Version : Growing Lines with Actionscript
musicman1088
June 22nd, 2009, 03:25 PM
I searched this forum for growing lines but didn't see any solution via pure actionscript.
How do you suppose something like the Audi site "Rhythm of Lines", in which you have several interweaving and growing "vines", was implemented?
http://www.rhythmoflines.co.uk (http://www.rhythmoflines.co.uk/)
I'd like to understand how this effect is achieved. Is it just adding a series of small circles and then transposing everything to shift downward?
Dimitree
June 22nd, 2009, 03:58 PM
Check this http://blog.soulwire.co.uk/flash/actionscript-3/papervision3d/pv3d-ribbon3d-class/
musicman1088
June 22nd, 2009, 05:22 PM
Thanks, that's a very interesting site. I see he uses a 3D library of some sort. But what if I just want a 2D growing line. Like this site: http://soytuaire.labuat.com/
creatify
June 22nd, 2009, 08:10 PM
potential resource: http://blog.oaxoa.com/
musicman1088
August 3rd, 2009, 02:16 AM
I think I figured out how to draw a continuous line that follow the mouse pointer position by creating a sprite and using the graphics lineTo function. Now I want to "pan the camera" to the right as in this site: http://soytuaire.labuat.com/
However, if I move my sprite's x coordinate, the lineTo and mouse location no longer line up, they grow further and further away, and eventually the sprite moves entirely off screen. Why is that?
var sp:Sprite = new Sprite();
addChild(sp);
var g:Graphics = sp.graphics;
g.lineStyle(1, 0x000000);
sp.addEventListener(Event.ENTER_FRAME, draw_line);
function draw_line(evt:Event):void {
sp.x += -1; //pan camera to the right
g.lineTo(mouseX,mouseY);
}
Krilnon
August 3rd, 2009, 02:30 AM
It's because the mouse position that you're accessing is not relative to the Sprite that you're moving. Instead, you should probably use this code: g.lineTo(sp.mouseX, sp.mouseY);
musicman1088
August 3rd, 2009, 08:20 PM
Wow. Thanks! That worked. But how can I get this "pan" to speed up without causing refresh-scanlines artifacts? This might be a screen redraw issue, but if I increase sp.x += 1 to around 30 which is how fast I want the pan, the line starts getting really blurry and choppy, something that the site I'm trying to mimick doesn't suffer from. I tried increasing the line width and frame rate but it doesn't smoothen out the animation. And I'm on a pretty fast Macbook Pro so I don't think it's my computer. Are there tricks to optimizing the animation?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.