Update rotates primitives examples.

This commit is contained in:
Jürg Lehni 2013-10-14 19:56:51 +02:00
parent 7285ec636a
commit d8f7799fc4
2 changed files with 47 additions and 18 deletions

View file

@ -8,26 +8,37 @@
<script type="text/paperscript" canvas="canvas1"> <script type="text/paperscript" canvas="canvas1">
// This "arbitrary" shape triggered rectangles in the original code, // This "arbitrary" shape triggered rectangles in the original code,
// since point2 is as far from point0 as point3 is from point1. // since point2 is as far from point0 as point3 is from point1.
var path = new Path(); var path = new Path({
closed: true,
strokeColor: 'black'
});
path.moveTo(0, 0); path.moveTo(0, 0);
path.lineTo(50, 50); path.lineTo(50, 50);
path.lineTo(100, 100); path.lineTo(100, 100);
path.lineTo(-50, 150); path.lineTo(-50, 150);
path.closed = true;
path.strokeColor = 'black';
path.position += 100; path.position += 100;
var rect = new Path.Rectangle(200, 100, 200, 300); var rect = new Path.Rectangle({
rect.fillColor = 'red'; point: [200, 100],
size: [200, 300],
fillColor: 'red'
});
rect.rotate(40); rect.rotate(40);
var circle = new Path.Circle(200, 300, 100); var circle = new Path.Circle({
circle.fillColor = 'green'; center: [200, 300],
radius: 100,
fillColor: 'green'
});
circle.scale(0.5, 1); circle.scale(0.5, 1);
circle.rotate(40); circle.rotate(40);
var rect = new Path.Rectangle(250, 20, 200, 300, 40, 20); var rect = new Path.Rectangle({
rect.fillColor = 'yellow'; point: [250, 20],
size: [200, 300],
radius: [40, 20],
fillColor: 'yellow'
});
rect.rotate(-20); rect.rotate(-20);
window._json = project.exportJSON(); window._json = project.exportJSON();

View file

@ -8,26 +8,44 @@
<script type="text/paperscript" canvas="canvas"> <script type="text/paperscript" canvas="canvas">
// This "arbitrary" shape triggered rectangles in the original code, // This "arbitrary" shape triggered rectangles in the original code,
// since point2 is as far from point0 as point3 is from point1. // since point2 is as far from point0 as point3 is from point1.
var path = new Path(); var path = new Path({
closed: true,
strokeColor: 'black'
});
path.moveTo(0, 0); path.moveTo(0, 0);
path.lineTo(50, 50); path.lineTo(50, 50);
path.lineTo(100, 100); path.lineTo(100, 100);
path.lineTo(-50, 150); path.lineTo(-50, 150);
path.closed = true;
path.strokeColor = 'black';
path.position += 100; path.position += 100;
var rect = new Path.Rectangle(200, 100, 200, 300); var rect = new Path.Rectangle({
rect.fillColor = 'red'; point: [200, 100],
size: [200, 300],
fillColor: 'red'
});
rect.rotate(40); rect.rotate(40);
var circle = new Path.Circle(200, 300, 100); var circle = new Path.Circle({
circle.fillColor = 'green'; center: [200, 300],
radius: 100,
fillColor: 'green'
});
circle.scale(0.5, 1); circle.scale(0.5, 1);
circle.rotate(40); circle.rotate(40);
var rect = new Path.Rectangle(250, 20, 200, 300, 40, 20); var ellipse = new Shape.Ellipse({
rect.fillColor = 'yellow'; point: [300, 300],
size: [100, 200],
fillColor: 'blue'
});
ellipse.rotate(-40);
var rect = new Path.Rectangle({
point: [250, 20],
size: [200, 300],
radius: [40, 20],
fillColor: 'yellow'
});
rect.rotate(-20); rect.rotate(-20);
rect.data = { rect.data = {
string: '----', string: '----',