mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Improve Style example code.
This commit is contained in:
parent
191213f362
commit
d4d1a0fdae
1 changed files with 29 additions and 11 deletions
|
@ -24,7 +24,7 @@
|
||||||
* {@link Item#style}. This is a convenient way to define a style once and
|
* {@link Item#style}. This is a convenient way to define a style once and
|
||||||
* apply it to a series of items:
|
* apply it to a series of items:
|
||||||
*
|
*
|
||||||
* @classexample {@paperscript}
|
* @classexample {@paperscript} // Styling paths
|
||||||
*
|
*
|
||||||
* var path = new Path.Circle(new Point(80, 50), 30);
|
* var path = new Path.Circle(new Point(80, 50), 30);
|
||||||
* path.style = {
|
* path.style = {
|
||||||
|
@ -33,19 +33,37 @@
|
||||||
* strokeWidth: 5
|
* strokeWidth: 5
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* @classexample
|
* @classexample {@paperscript} // Styling text items
|
||||||
* var text = new PointText(new Point(50, 50));
|
* var text = new PointText(view.center);
|
||||||
* text.content = 'Hello world.';
|
* text.content = 'Hello world.';
|
||||||
* text.style = {
|
* text.style = {
|
||||||
* fontSize: 50,
|
* fontSize: 20,
|
||||||
* fillColor: 'black',
|
* fillColor: 'red',
|
||||||
|
* justification: 'center'
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* @classexample
|
* @classexample {@paperscript} // Styling groups
|
||||||
* var text = new PointText(new Point(0,0));
|
* var path1 = new Path.Circle({
|
||||||
* text.fillColor = 'black';
|
* center: [100, 50],
|
||||||
* text.content = 'Hello world.';
|
* radius: 30
|
||||||
* text.justification = 'center';
|
* });
|
||||||
|
*
|
||||||
|
* var path2 = new Path.Rectangle({
|
||||||
|
* from: [170, 20],
|
||||||
|
* to: [230, 80]
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* var group = new Group(path1, path2);
|
||||||
|
*
|
||||||
|
* // All styles set on a group are automatically
|
||||||
|
* // set on the children of the group:
|
||||||
|
* group.style = {
|
||||||
|
* strokeColor: 'black',
|
||||||
|
* dashArray: [4, 10],
|
||||||
|
* strokeWidth: 4,
|
||||||
|
* strokeCap: 'round'
|
||||||
|
* };
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
var Style = this.Style = Base.extend(new function() {
|
var Style = this.Style = Base.extend(new function() {
|
||||||
// windingRule / resolution / fillOverprint / strokeOverprint are currently
|
// windingRule / resolution / fillOverprint / strokeOverprint are currently
|
||||||
|
|
Loading…
Reference in a new issue