home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
- ADOBE SYSTEMS INCORPORATED
- Copyright 2002 Adobe Systems Incorporated
- All Rights Reserved
-
- NOTICE: Adobe permits you to use, modify, and distribute this
- file in accordance with the terms of the Adobe license agreement
- accompanying it. If you have received this file from a source
- other than Adobe, then your use, modification, or distribution
- of it requires the prior written permission of Adobe.
- ***************************************************************/
- /***************************************************************
- Author: Ken Villines
- ***************************************************************/
-
- /***************************************************************
-
- This file is an include file used for Automation Scripting.
-
- *************Function Definitions****************
-
-
- These functions return the object shape stated --
-
-
- ellipse(w, h, x, y [r, g, b])
-
- w = width , h = height, x = x coordinate, y = y coordinate,(Optional Args r = red , g = green , b = blue)
-
- returns an ellipse object
-
-
- polygon(w, h, x, y, s, [r, g, b])
-
- w = width , h = height , x = x coordinate, y = y coordinate, s = sides (Optional Args r = red , g = green , b = blue)
-
- returns a polygon object
-
-
- roundedRectangle(w, h, x, y, cr, [r, g, b])
-
- w = width , h = height , x = x coordinate, y = y coordinate, cr = corner radius (Optional Args r = red , g = green , b = blue)
-
- returns a rounded rectangle object
-
-
- rectangle(w, h, x, y, [r, g, b])
-
- w = width , h = height, x = x coordinate, y = y coordinate,(Optional Args r = red , g = green , b = blue)
-
- returns a rectangle object
-
-
- path(w, h, x, y,[r, g, b])
-
- w = width , h = height, x = x coordinate, y = y coordinate, (Optional Args r = red , g = green , b = blue)
-
- returns a path object
-
- ***************************************************************/
-
- /***************************************************************
- DO NOT EDIT BELOW THIS LINE
- ***************************************************************/
-
-
-
- function getCC()
- {
- return application.currentComposition;
- }
-
-
-
- function ellipse(w, h, x, y, r, g, b)
- {
- var Obj = getCC().createObject(LMObjectType.geometric, x, y);
- var newEllipse = Obj.convertType(LMGeometricType.ellipse);
- newEllipse.size.x = w;
- newEllipse.size.y = h;
-
- if(r)
- {
- var maxVal = Math.max(r, 255); //if argument exists check bounds
- var minVal = Math.min(r, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newEllipse.layers[0].colorGradient.startColor.red = r;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The RED value was not set\n");
- return null;
- }
- }
- else
- {
- newEllipse.layers[0].colorGradient.startColor.red = 0;
- }
-
-
- if(g)
- {
- var maxVal = Math.max(g, 255); //if argument exists check bounds
- var minVal = Math.min(g, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newEllipse.layers[0].colorGradient.startColor.green = g;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The GREEN value was not set\n");
- return null;
- }
- }
- else
- {
- newEllipse.layers[0].colorGradient.startColor.green = 0;
- }
-
- if(b)
- {
- var maxVal = Math.max(b, 255); //if argument exists check bounds
- var minVal = Math.min(b, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newEllipse.layers[0].colorGradient.startColor.blue = b;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The BLUE value was not set\n");
- return null;
- }
- }
- else
- {
- newEllipse.layers[0].colorGradient.startColor.blue = 0;
- }
-
- return newEllipse;
- }
-
-
-
- function polygon(w, h, x, y, s, r, g, b)
- {
- var Obj = getCC().createObject(LMObjectType.geometric, x, y);
- var newPolygon = Obj.convertType(LMGeometricType.polygon);
- newPolygon.size.x = w;
- newPolygon.size.y = h;
-
- var sideMaxVal = Math.max(s, 10); //if argument exists check bounds
- var sideMinVal = Math.min(s, 3);
-
- if(sideMaxVal <= 10 && sideMinVal >= 3){
- newPolygon.sides = s;
- }
- else
- {
- Console.write("ERROR: Number of sides is between 3 and 10\n");
- Console.write("The number of sides were not set\n");
- return null;
- }
-
- if(r)
- {
- var maxVal = Math.max(r, 255); //if argument exists check bounds
- var minVal = Math.min(r, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPolygon.layers[0].colorGradient.startColor.red = r;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The RED value was not set\n");
- return null;
- }
- }
- else
- {
- newPolygon.layers[0].colorGradient.startColor.red = 0;
- }
-
-
- if(g)
- {
- var maxVal = Math.max(g, 255); //if argument exists check bounds
- var minVal = Math.min(g, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPolygon.layers[0].colorGradient.startColor.green = g;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The GREEN value was not set\n");
- return null;
- }
- }
- else
- {
- newPolygon.layers[0].colorGradient.startColor.green = 0;
- }
-
- if(b)
- {
- var maxVal = Math.max(b, 255); //if argument exists check bounds
- var minVal = Math.min(b, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPolygon.layers[0].colorGradient.startColor.blue = b;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The BLUE value was not set\n");
- return null;
- }
- }
- else
- {
- newPolygon.layers[0].colorGradient.startColor.blue = 0;
- }
- return newPolygon;
- }
-
-
-
-
- function roundedRectangle(w, h, x, y, cr, r, g, b)
- {
- var Obj = getCC().createObject(LMObjectType.geometric, x, y);
- var newRoundedRectangle = Obj.convertType(LMGeometricType.roundedRectangle);
- newRoundedRectangle.size.x = w;
- newRoundedRectangle.size.y = h;
-
- var radiusMaxVal = Math.max(cr, 200); //if argument exists check bounds
- var radiusMinVal = Math.min(cr, 0);
-
- if(radiusMaxVal <= 200 && radiusMinVal >= 0){
- newRoundedRectangle.cornerRadius = cr;
- }
- else
- {
- Console.write("ERROR: The radius should be between 0 and 200\n");
- Console.write("The radius was not set\n");
- return null;
- }
-
- if(r)
- {
- var maxVal = Math.max(r, 255); //if argument exists check bounds
- var minVal = Math.min(r, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRoundedRectangle.layers[0].colorGradient.startColor.red = r;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The RED value was not set\n");
- return null;
- }
- }
- else
- {
- newRoundedRectangle.layers[0].colorGradient.startColor.red = 0;
- }
-
-
- if(g)
- {
- var maxVal = Math.max(g, 255); //if argument exists check bounds
- var minVal = Math.min(g, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRoundedRectangle.layers[0].colorGradient.startColor.green = g;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The GREEN value was not set\n");
- return null;
- }
- }
- else
- {
- newRoundedRectangle.layers[0].colorGradient.startColor.green = 0;
- }
-
- if(b)
- {
- var maxVal = Math.max(b, 255); //if argument exists check bounds
- var minVal = Math.min(b, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRoundedRectangle.layers[0].colorGradient.startColor.blue = b;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The BLUE value was not set\n");
- return null;
- }
- }
- else
- {
- newRoundedRectangle.layers[0].colorGradient.startColor.blue = 0;
- }
-
- return newRoundedRectangle;
- }
-
-
-
- function rectangle(w, h, x, y, r, g, b)
- {
- var Obj = getCC().createObject(LMObjectType.geometric, x, y);
- var newRectangle = Obj.convertType(LMGeometricType.rectangle);
- newRectangle.size.x = w;
- newRectangle.size.y = h;
-
- if(r)
- {
- var maxVal = Math.max(r, 255); //if argument exists check bounds
- var minVal = Math.min(r, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRectangle.layers[0].colorGradient.startColor.red = r;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The RED value was not set\n");
- return null;
- }
- }
- else
- {
- newRectangle.layers[0].colorGradient.startColor.red = 0;
- }
-
-
- if(g)
- {
- var maxVal = Math.max(g, 255); //if argument exists check bounds
- var minVal = Math.min(g, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRectangle.layers[0].colorGradient.startColor.green = g;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The GREEN value was not set\n");
- return null;
- }
- }
- else
- {
- newRectangle.layers[0].colorGradient.startColor.green = 0;
- }
-
- if(b)
- {
- var maxVal = Math.max(b, 255); //if argument exists check bounds
- var minVal = Math.min(b, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newRectangle.layers[0].colorGradient.startColor.blue = b;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The BLUE value was not set\n");
- return null;
- }
- }
- else
- {
- newRectangle.layers[0].colorGradient.startColor.blue = 0;
- }
-
- return newRectangle;
- }
-
-
-
- function path(w, h, x, y, r, g, b)
- {
- var Obj = getCC().createObject(LMObjectType.geometric, x, y);
- var newPath = Obj.convertType(LMGeometricType.path);
- newPath.size.x = w;
- newPath.size.y = h;
-
- if(r)
- {
- var maxVal = Math.max(r, 255); //if argument exists check bounds
- var minVal = Math.min(r, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPath.layers[0].colorGradient.startColor.red = r;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The RED value was not set\n");
- return null;
- }
- }
- else
- {
- newPath.layers[0].colorGradient.startColor.red = 0;
- }
-
-
- if(g)
- {
- var maxVal = Math.max(g, 255); //if argument exists check bounds
- var minVal = Math.min(g, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPath.layers[0].colorGradient.startColor.green = g;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The GREEN value was not set\n");
- return null;
- }
- }
- else
- {
- newPath.layers[0].colorGradient.startColor.green = 0;
- }
-
- if(b)
- {
- var maxVal = Math.max(b, 255); //if argument exists check bounds
- var minVal = Math.min(b, 0);
-
- if(maxVal <= 255 && minVal >= 0){
- newPath.layers[0].colorGradient.startColor.blue = b;
- }
- else
- {
- Console.write("ERROR: Color values are between 0 and 255\n");
- Console.write("The BLUE value was not set\n");
- return null;
- }
- }
- else
- {
- newPath.layers[0].colorGradient.startColor.blue = 0;
- }
-
- return newPath;
- }
-
-