home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 July / com!online0702.iso / software / livemotion / DATA1.CAB / Automation / Scripts / Stroke Fill Maker.js < prev    next >
Encoding:
JavaScript  |  2002-05-13  |  2.6 KB  |  76 lines

  1. /***************************************************************
  2. ADOBE SYSTEMS INCORPORATED 
  3. Copyright 2002 Adobe Systems Incorporated 
  4. All Rights Reserved 
  5.  
  6. NOTICE:  Adobe permits you to use, modify, and distribute this 
  7. file in accordance with the terms of the Adobe license agreement 
  8. accompanying it.  If you have received this file from a source 
  9. other than Adobe, then your use, modification, or distribution
  10. of it requires the prior written permission of Adobe. 
  11. ***************************************************************/
  12.  
  13. /***************************************************************
  14. Author: Henry Lee
  15. ***************************************************************/
  16.  
  17. /***************************************************************
  18.  
  19. This script takes a selected LMGeometricObject and adds a stroke.
  20. If the object is already a stroke, it will convert it into a 
  21. fill then add the stroke.
  22.  
  23. Function:
  24.     MakeStrokeFill(objs, red, green, blue, width)
  25.  
  26. Arguments:
  27.     <objs> LMGeometricObjects - the array of objects to which
  28.         the script will be applied
  29.     <red>,<green>,<blue> integer - the RGB values of the stroke.
  30.         Ranges from 0 to 255.
  31.     <width> integer - the width of the stroke
  32.  
  33. ***************************************************************/
  34.  
  35. /***************************************************************
  36. To change the behavior of this script, make your changes below
  37. ***************************************************************/
  38.  
  39. var comp = application.currentComposition;
  40. var objects = comp.selection; 
  41.  
  42. MakeStrokeFill(objects, 0, 0, 0, 1);
  43.  
  44. /***************************************************************
  45. DO NOT EDIT BELOW THIS LINE
  46. ***************************************************************/
  47.  
  48. function MakeStrokeFill(objs, red, green, blue, width) {
  49.     var i;
  50.     var newGroup = new Array();
  51.     var tempObj;
  52.     var objName;
  53.     var strokeLayer;
  54.  
  55.     for (i=0;i<objs.length;i++) {
  56.         if ((objs[i] == "[object LMPolygonObject]")||(objs[i] == "[object LMRectangleObject]")||
  57.           (objs[i] == "[object LMRoundedRectangleObject]")||(objs[i] == "[object LMEllipseObject]")||
  58.           (objs[i] == "[object LMPathObject]")) {
  59.             objs[i].stroke.type = LMStrokeType.fill;
  60.             objs[i].addLayer();
  61.             strokeLayer = objs[i].layers.length - 1;
  62.             objs[i].layers[strokeLayer].width = width;
  63.             objs[i].layers[strokeLayer].colorGradient.startColor.red = red;
  64.             objs[i].layers[strokeLayer].colorGradient.startColor.green = green;
  65.             objs[i].layers[strokeLayer].colorGradient.startColor.blue = blue;
  66.         }
  67.     }  
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.