Color
// Create a circle shaped path at {x: 80, y: 50}
// with a radius of 30.
var circle = new Path.Circle(new Point(80, 50), 30);
// Pass a color name to the fillColor property, which is internally
// converted to a Color.
circle.fillColor = 'green';// Create a circle shaped path at {x: 80, y: 50}
// with a radius of 30.
var circle = new Path.Circle(new Point(80, 50), 30);
// Pass a hex string to the fillColor property, which is internally
// converted to a Color.
circle.fillColor = '#ff0000';Constructors
// Create a circle shaped path at {x: 80, y: 50} // with a radius of 30: var circle = new Path.Circle(new Point(80, 50), 30); // 100% red, 0% blue, 50% blue: circle.fillColor = new Color(1, 0, 0.5);// Create a circle shaped path at {x: 80, y: 50} // with a radius of 30: var circle = new Path.Circle(new Point(80, 50), 30); // Create a GrayColor with 50% gray: circle.fillColor = new Color(0.5);// Create a circle shaped path at {x: 80, y: 50} // with a radius of 30: var circle = new Path.Circle(new Point(80, 50), 30); // Create an HSB Color with a hue of 90 degrees, a saturation // 100% and a brightness of 100%: circle.fillColor = { hue: 90, saturation: 1, brightness: 1 };// Create a circle shaped path at {x: 80, y: 50} // with a radius of 30: var circle = new Path.Circle(new Point(80, 50), 30); // Create an HSL Color with a hue of 90 degrees, a saturation // 100% and a lightness of 50%: circle.fillColor = { hue: 90, saturation: 1, lightness: 0.5 };// Define two points which we will be using to construct // the path and to position the gradient color: var topLeft = view.center - [80, 80]; var bottomRight = view.center + [80, 80]; var path = new Path.Rectangle({ topLeft: topLeft, bottomRight: bottomRight, // Fill the path with a gradient of three color stops // that runs between the two points we defined earlier: fillColor: { stops: ['yellow', 'red', 'blue'], origin: topLeft, destination: bottomRight } });var circle = new Path.Circle({ center: [80, 50], radius: 30, fillColor: new Color('rgba(255, 255, 0, 0.5)') });// Define two points which we will be using to construct // the path and to position the gradient color: var topLeft = view.center - [80, 80]; var bottomRight = view.center + [80, 80]; // Create a rectangle shaped path between // the topLeft and bottomRight points: var path = new Path.Rectangle(topLeft, bottomRight); // Create the gradient, passing it an array of colors to be converted // to evenly distributed color stops: var gradient = new Gradient(['yellow', 'red', 'blue']); // Have the gradient color run between the topLeft and // bottomRight points we defined earlier: var gradientColor = new Color(gradient, topLeft, bottomRight); // Set the fill color of the path to the gradient color: path.fillColor = gradientColor;// Create a circle shaped path at the center of the view // with a radius of 80: var path = new Path.Circle({ center: view.center, radius: 80 }); // The stops array: yellow mixes with red between 0 and 15%, // 15% to 30% is pure red, red mixes with black between 30% to 100%: var stops = [ ['yellow', 0], ['red', 0.15], ['red', 0.3], ['black', 0.9] ]; // Create a radial gradient using the color stops array: var gradient = new Gradient(stops, true); // We will use the center point of the circle shaped path as // the origin point for our gradient color var from = path.position; // The destination point of the gradient color will be the // center point of the path + 80pt in horizontal direction: var to = path.position + [80, 0]; // Create the gradient color: var gradientColor = new Color(gradient, from, to); // Set the fill color of the path to the gradient color: path.fillColor = gradientColor;
Operators
Properties
RGB Components
Gray Components
HSB Components
HSL Components
Gradient Components
Methods
String Representations
Math Operator Functions
Static Methods
Was this helpful?