toCSSFormat(withPropName: Boolean, externalStops: Object);
withPropName. Indicates if the string contains name of the property, for which linear gradient fill brush settings must be applied. Optional parameter. Default value is True.
externalStops. Array of transition points in gradient. Optional parameter. By default an array of transition points of the object, at which the method is called, is used.
The toCSSFormat method returns a string in the CSS format with settings of linear gradient fill brush.
To execute the example, the HTML page must contain links to the jquery.js, PP.js scenario files, and the PP.css styles file. Create a div element and set background gradient fill for it:
// Create a div element var divElem = PP.createElement(document.body); // Set up styles for this element divElem.style.cssText = "width: 200px; height: 100px; border: 1px solid rgb(102, 102, 102);"; // Create a brush with linear gradient fill var gradient = new PP.LinearGradientBrush({ EndPoint: "1, 1", Angle: 175, StartPoint: "0, 0", GradientStops: { "GradientStop": [{ "Offset": "0", "Color": "#ffdd00cc" }, { "Offset": "1", "Color": "#ffaaffcc" }] } }); // Set background fill for the div element divElem.style.cssText += gradient.toCSSFormat();
After executing the example a div element is created in the document, for which linear gradient fill was applied:
See also: