PDA

View Full Version : Progressive Drawing


prestonblade
06-11-2006, 02:19 AM
Hi, I'm trying to get my head round the idea of a line drawing getting progressively larger. I basically want a line to start out small and gradually unfold out to be longer and have further lines 'growing' from it a sort of growing branch on a tree effect. I've tried frame by frame (looks terrible) and I read about an actionscript class but it seemed a tad advanced. Surely there is an easier way? If anyone can point me in the right direction, its greatly appreciated.
Thanks

Sunny13
06-11-2006, 06:07 AM
Can give you an idea... Draw a line and place two movieclips on the both ends of it... so that whenever you drag any one one of these clips ... the line will be redrawn along with movement of movieclip... for branches place ... if you select the line itself(which is also a movieclip) and not the movieclips at both ends... draw a new line ... hope this can help you.

prestonblade
06-11-2006, 11:45 AM
Would it possible to then tween these to make the effect look desirable? I'm not sure I follow what you mean exactly

lattasource
06-13-2006, 10:24 AM
read up on the drawing class. Basically you will want to plot out the points of your drawing in the order you want them to be drawn. Stick those into an array. Then make a function that will draw from the current point to the next point in the array and use a setInterval to cycle the function with the array.


var thePoints:Array = new Array()
thePoints[0] = [0,250]
thePoints[1] = [20,270]
thePoints[2] = [40,260]
thePoints[3] = [60,290]
thePoints[4] = [70,320]
thePoints[5] = [80,300]
thePoints[6] = [100,280]
thePoints[7] = [120,210]
thePoints[8] = [140,240]
thePoints[9] = [160,220]
thePoints[10] = [180,230]
thePoints[11] = [200,240]
thePoints[12] = [220,270]


function drawIt(){
drawSpace.lineTo(thePoints[i][0], thePoints[i][1]);
if(i >= thePoints.length-1){
clearInterval(drawID)
}
i++
}

this.createEmptyMovieClip("drawSpace", 1);
drawSpace.lineStyle(3, 0x000000, 200);
drawSpace.moveTo(thePoints[0][0], thePoints[0][1]);
drawID = setInterval(drawIt, 1000)
i=1

Fresh_ales
06-13-2006, 05:54 PM
lattasource...
the code dosent work:p
Trying to do something like this....
If someone has a solution....tell us!
Fresh:D

lattasource
06-14-2006, 06:27 AM
lattasource...
the code dosent work:p
Trying to do something like this....
If someone has a solution....tell us!
Fresh:D
copied and pasted the code again and it works. Make sure the code looks like it does in the post and not all pasted on 1 line. Do you have the proper returns when you paste it into flash.

Fresh_ales
06-14-2006, 11:52 AM
copied and pasted the code again and it works. Make sure the code looks like it does in the post and not all pasted on 1 line. Do you have the proper returns when you paste it into flash.
Sorry...... it really works.....
fresh_ales:p