[Papervision3D] Lines3D alpha help

slopester slope at slopester.com
Sat Aug 30 17:15:20 PDT 2008


I'll answer myself in case anyone searches this issue in future.
This is the solution I've arrived at - there may be better....

Use addLine() instead of addNewLine() when adding segments to a lines3D.  addLine has a material attribute that addNewLine doesn't . This allows you to create a new LineMaterial for each segment as it's added:
In my code I have an array called 'points' which I am using for x, y and z values

mylinematerial:LineMaterial = new LineMaterial(0xffff00,1);
l3d:Lines3D = new Lines3D(mylinematerial);
var linealpha:Number = 1;
for(var i:uint=0;i<points.length-1;i++)
   {
   l3d.addLine(new Line3D(l3d, mylinematerial, 2, new Vertex3D(points[i]['x'],points[i]['y'],points[i]['z']), new Vertex3D(points[i+1]['x'],points[i+1]['y'],points[i+1]['z'])));
   linealpha-=1/points.length;
   mylinematerial= new LineMaterial(0xffff00,linealpha);
   }

voila! line fades out.

slopes
  ----- Original Message ----- 
  From: slopester 
  To: papervision3d at osflash.org 
  Sent: Friday, August 29, 2008 12:38 PM
  Subject: [Papervision3D] Lines3D alpha help


  Hi List

  I am using Lines3D to draw a curve by looping thru an array of points.  I would like to drop the alpha of each line segment as I loop thru so the line appears to fade out.  I can't figure how to do this as the material is applied to the Lines3D, is it possible to modify the alpha of each individual line segment?  Or does anyone know a better way to achieve this fadeout I'm after?

  Any help much appreciated  :o)

  slopes


  __what I'm doing_________________________________________________

  var l3d:Lines3D = new Lines3D(myLineMaterial);
  for(var j:uint=0;j<points.length-1;j++)
     {
     line = l3d.addNewLine(2,0,points[j]['dist'],-points[j]['hgt'],0,points[j+1]['dist'],-points[j+1]['hgt']);
     }


  __trying to achieve something like this______________________________

  var linealpha:Number = 1;
  for(var j:uint=0;j<points.length-1;j++)
     {
     line = l3d.addNewLine(2,0,points[j]['dist'],-points[j]['hgt'],0,points[j+1]['dist'],-points[j+1]['hgt']);
     line.material.alpha = linealpha;
     linealpha-=0.1;
     }


------------------------------------------------------------------------------


  _______________________________________________
  Papervision3D mailing list
  Papervision3D at osflash.org
  http://osflash.org/mailman/listinfo/papervision3d_osflash.org



------------------------------------------------------------------------------



  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com 
  Version: 8.0.169 / Virus Database: 270.6.13/1641 - Release Date: 29/08/2008 07:07
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20080831/5cbc68d4/attachment.html 


More information about the Papervision3D mailing list