mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Update Tadpoles example to use Project#importJson.
This commit is contained in:
parent
945a7220ee
commit
676a207871
1 changed files with 3 additions and 25 deletions
|
@ -37,11 +37,9 @@
|
|||
this.shortPath.strokeWidth = 4;
|
||||
for (var i = 0, l = strength * 10 + 10; i < l; i++) {
|
||||
this.path.add(this.loc);
|
||||
if (i < 3)
|
||||
this.shortPath.add(this.loc);
|
||||
}
|
||||
|
||||
this.firstSegment = this.path.segments[0];
|
||||
this.firstSegment = this.path.firstSegment;
|
||||
this.count = 0;
|
||||
this.lastRot = 0;
|
||||
},
|
||||
|
@ -77,7 +75,6 @@
|
|||
var rot = vector.angle;
|
||||
this.head.rotate(rot - this.lastRot);
|
||||
this.lastRot = rot;
|
||||
|
||||
this.shortPath.segments = segments.slice(0, 3);
|
||||
},
|
||||
|
||||
|
@ -118,7 +115,7 @@
|
|||
// Two options for desired vector magnitude
|
||||
// (1 -- based on distance, 2 -- maxSpeed)
|
||||
if (slowdown && d < 100) {
|
||||
// // This damping is somewhat arbitrary:
|
||||
// This damping is somewhat arbitrary:
|
||||
desired.length = this.maxSpeed * (d / 100);
|
||||
} else {
|
||||
desired.length = this.maxSpeed;
|
||||
|
@ -229,26 +226,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
var heartPath = new Path([
|
||||
[[514.6962890625, 624.703125], [7.0966796875, -26.3369140625], [-7.10205078125, -27.0244140625]],
|
||||
[[484.29052734375, 548.6025390625], [13.16845703125, 23.7060546875], [-13.173828125, -23.70703125]],
|
||||
[[407.84619140625, 438.14453125], [37.79296875, 49.935546875], [-27.71630859375, -36.6435546875]],
|
||||
[[356.654296875, 368.400390625], [6.41015625, 9.8505859375], [-10.53759765625, -16.02978515625]],
|
||||
[[333.80712890625, 324.25146484375], [4.69189453125, 13.3994140625], [-4.697265625, -13.39892578125]],
|
||||
[[326.76416015625, 283.53857421875], [0, 13.74267578125], [0, -25.42431640625]],
|
||||
[[352.18798828125, 219.634765625], [-16.95263671875, 17.17822265625], [16.94775390625, -17.1787109375]],
|
||||
[[415.0615234375, 193.8671875], [-24.96826171875, 0], [25.19287109375, 0]],
|
||||
[[480.68310546875, 220.66552734375], [-18.552734375, -17.86572265625], [13.96826171875, 13.28662109375]],
|
||||
[[514.6962890625, 280.10302734375], [-8.70703125, -26.3369140625], [7.55859375, -25.88037109375]],
|
||||
[[546.6484375, 221.0087890625], [-13.7431640625, 13.517578125], [19.0087890625, -18.32177734375]],
|
||||
[[612.61328125, 193.5234375], [-24.9677734375, 0], [24.7373046875, 0]],
|
||||
[[675.486328125, 219.119140625], [-17.177734375, -17.06005859375], [17.1787109375, 17.06591796875]],
|
||||
[[701.2548828125, 280.10302734375], [0, -23.58837890625], [0, 20.61376953125]],
|
||||
[[686.1376953125, 344.52197265625], [10.076171875, -22.33203125], [-10.08203125, 22.33203125]],
|
||||
[[627.73046875, 432.3046875], [28.8603515625, -36.1875], [-37.5673828125, 47.412109375]],
|
||||
[[545.6171875, 549.1171875], [17.1787109375, -30.458984375], [-13.517578125, 24.0498046875]]
|
||||
]);
|
||||
heartPath.closed = true;
|
||||
var heartPath = Project.importJson('["Path",{"pathData":"M514.69629,624.70313c-7.10205,-27.02441 -17.2373,-52.39453 -30.40576,-76.10059c-13.17383,-23.70703 -38.65137,-60.52246 -76.44434,-110.45801c-27.71631,-36.64355 -44.78174,-59.89355 -51.19189,-69.74414c-10.5376,-16.02979 -18.15527,-30.74951 -22.84717,-44.14893c-4.69727,-13.39893 -7.04297,-26.97021 -7.04297,-40.71289c0,-25.42432 8.47119,-46.72559 25.42383,-63.90381c16.94775,-17.17871 37.90527,-25.76758 62.87354,-25.76758c25.19287,0 47.06885,8.93262 65.62158,26.79834c13.96826,13.28662 25.30615,33.10059 34.01318,59.4375c7.55859,-25.88037 18.20898,-45.57666 31.95215,-59.09424c19.00879,-18.32178 40.99707,-27.48535 65.96484,-27.48535c24.7373,0 45.69531,8.53564 62.87305,25.5957c17.17871,17.06592 25.76855,37.39551 25.76855,60.98389c0,20.61377 -5.04102,42.08691 -15.11719,64.41895c-10.08203,22.33203 -29.54687,51.59521 -58.40723,87.78271c-37.56738,47.41211 -64.93457,86.35352 -82.11328,116.8125c-13.51758,24.0498 -23.82422,49.24902 -30.9209,75.58594z","strokeColor":["rgb",1,1,1],"strokeWidth":2,"strokeCap":"round"}]');
|
||||
heartPath.position = view.center;
|
||||
heartPath.strokeColor = null;
|
||||
heartPath.scale(1.5);
|
||||
|
|
Loading…
Reference in a new issue