mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
parent
84421abbce
commit
83a2fa0749
1 changed files with 41 additions and 0 deletions
|
@ -148,4 +148,45 @@ if (!isNode) {
|
|||
var svg = project.exportSVG({ bounds: 'content', asString: true });
|
||||
compareSVG(assert.async(), svg, project.activeLayer);
|
||||
});
|
||||
|
||||
test('Export gradients', function(assert) {
|
||||
var bounds = new Rectangle(new Size(300, 600));
|
||||
var stops = [new Color(1, 1, 0, 0), 'red', 'black'];
|
||||
|
||||
var radius = bounds.width * 0.4,
|
||||
from = new Point(bounds.center.x),
|
||||
to = from + [radius, 0];
|
||||
|
||||
var circle = new Path.Circle({
|
||||
center: from,
|
||||
radius: radius,
|
||||
fillColor: {
|
||||
stops: stops,
|
||||
radial: true,
|
||||
origin: from,
|
||||
destination: to
|
||||
},
|
||||
strokeColor: 'black'
|
||||
});
|
||||
|
||||
var from = bounds.leftCenter,
|
||||
to = bounds.bottomRight;
|
||||
|
||||
var rect = new Path.Rectangle({
|
||||
from: from,
|
||||
to: to,
|
||||
fillColor: {
|
||||
stops: stops,
|
||||
radial: false,
|
||||
origin: from,
|
||||
destination: to
|
||||
},
|
||||
strokeColor: 'black'
|
||||
});
|
||||
|
||||
rect.rotate(45).scale(0.7);
|
||||
|
||||
var svg = project.exportSVG({ bounds: 'content', asString: true });
|
||||
compareSVG(assert.async(), svg, project.activeLayer);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue