paper 0.17.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (474) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/LICENSE.txt +1 -1
  3. package/MIGRATION.md +402 -0
  4. package/README.md +137 -143
  5. package/dist/esm/anim/Tween.js +404 -0
  6. package/dist/esm/basic/Line.js +252 -0
  7. package/dist/esm/basic/Matrix.js +603 -0
  8. package/dist/esm/basic/Point.js +738 -0
  9. package/dist/esm/basic/Rectangle.js +788 -0
  10. package/dist/esm/basic/Size.js +368 -0
  11. package/dist/esm/boolean/graph.js +950 -0
  12. package/dist/esm/boolean/index.js +143 -0
  13. package/dist/esm/boolean/operations.js +94 -0
  14. package/dist/esm/boolean/split.js +89 -0
  15. package/dist/esm/canvas/blendModes.js +115 -0
  16. package/dist/esm/canvas/canvasProvider.js +102 -0
  17. package/dist/esm/constants.js +130 -0
  18. package/dist/esm/core/Base.js +52 -0
  19. package/dist/esm/core/Emitter.js +215 -0
  20. package/dist/esm/core/features.js +53 -0
  21. package/dist/esm/core/serialization.js +174 -0
  22. package/dist/esm/core.js +15 -0
  23. package/dist/esm/dom/domElement.js +112 -0
  24. package/dist/esm/dom/domEvent.js +106 -0
  25. package/dist/esm/env.js +66 -0
  26. package/dist/esm/event/DrawEvent.js +38 -0
  27. package/dist/esm/event/Event.js +79 -0
  28. package/dist/esm/event/Key.js +236 -0
  29. package/dist/esm/event/KeyEvent.js +39 -0
  30. package/dist/esm/event/MouseEvent.js +91 -0
  31. package/dist/esm/hosted/HostItem.js +60 -0
  32. package/dist/esm/hosted/Hosting.js +1061 -0
  33. package/dist/esm/hosted/index.js +20 -0
  34. package/dist/esm/index.js +38 -0
  35. package/dist/esm/internal.js +115 -0
  36. package/dist/esm/item/Effect.js +256 -0
  37. package/dist/esm/item/EffectInstance.js +184 -0
  38. package/dist/esm/item/Group.js +293 -0
  39. package/dist/esm/item/HitResult.js +126 -0
  40. package/dist/esm/item/Item.js +3339 -0
  41. package/dist/esm/item/ItemDefinition.js +95 -0
  42. package/dist/esm/item/Layer.js +69 -0
  43. package/dist/esm/item/Project.js +1013 -0
  44. package/dist/esm/item/Raster.js +722 -0
  45. package/dist/esm/item/Shape.js +355 -0
  46. package/dist/esm/item/SymbolDefinition.js +68 -0
  47. package/dist/esm/item/SymbolItem.js +131 -0
  48. package/dist/esm/item/bounds.js +324 -0
  49. package/dist/esm/item/draw.js +525 -0
  50. package/dist/esm/item/effects.js +124 -0
  51. package/dist/esm/item/expand.js +87 -0
  52. package/dist/esm/item/hitTest.js +203 -0
  53. package/dist/esm/item/hosting.js +12 -0
  54. package/dist/esm/item/props.js +12 -0
  55. package/dist/esm/item/query.js +139 -0
  56. package/dist/esm/item/sampling.js +67 -0
  57. package/dist/esm/item/transform.js +128 -0
  58. package/dist/esm/net/http.js +26 -0
  59. package/dist/esm/node/CanvasAdapter.js +137 -0
  60. package/dist/esm/node/index.js +150 -0
  61. package/dist/esm/node/peers.js +27 -0
  62. package/dist/esm/offset/curves.js +866 -0
  63. package/dist/esm/offset/index.js +70 -0
  64. package/dist/esm/offset/offset.js +178 -0
  65. package/dist/esm/offset/outline.js +91 -0
  66. package/dist/esm/offset/pen.js +298 -0
  67. package/dist/esm/offset/profile.js +772 -0
  68. package/dist/esm/offset/round.js +213 -0
  69. package/dist/esm/offset/sweep.js +100 -0
  70. package/dist/esm/paperscript/PaperScript.js +832 -0
  71. package/dist/esm/paperscript/autoload.js +27 -0
  72. package/dist/esm/paperscript/index.js +17 -0
  73. package/dist/esm/path/CompoundPath.js +367 -0
  74. package/dist/esm/path/Curve.js +996 -0
  75. package/dist/esm/path/CurveLocation.js +462 -0
  76. package/dist/esm/path/Path.js +1761 -0
  77. package/dist/esm/path/PathFlattener.js +186 -0
  78. package/dist/esm/path/PathItem.js +757 -0
  79. package/dist/esm/path/Segment.js +640 -0
  80. package/dist/esm/path/SegmentPoint.js +106 -0
  81. package/dist/esm/path/StrokeProfile.js +387 -0
  82. package/dist/esm/path/StrokeProfileStop.js +207 -0
  83. package/dist/esm/path/boolean.js +284 -0
  84. package/dist/esm/path/bounds.js +257 -0
  85. package/dist/esm/path/crossing.js +114 -0
  86. package/dist/esm/path/draw.js +161 -0
  87. package/dist/esm/path/hitTest.js +259 -0
  88. package/dist/esm/path/offset.js +152 -0
  89. package/dist/esm/path/shapes.js +231 -0
  90. package/dist/esm/path/smooth.js +84 -0
  91. package/dist/esm/path/values.js +40 -0
  92. package/dist/esm/scope/PaperScope.js +288 -0
  93. package/dist/esm/scope/PaperScopeItem.js +74 -0
  94. package/dist/esm/smoothing/index.js +71 -0
  95. package/dist/esm/style/Color.js +917 -0
  96. package/dist/esm/style/Gradient.js +191 -0
  97. package/dist/esm/style/GradientStop.js +168 -0
  98. package/dist/esm/style/PatternDefinition.js +383 -0
  99. package/dist/esm/style/Style.js +503 -0
  100. package/dist/esm/svg/index.js +27 -0
  101. package/dist/esm/svg/svgElement.js +97 -0
  102. package/dist/esm/svg/svgExport.js +847 -0
  103. package/dist/esm/svg/svgImport.js +1101 -0
  104. package/dist/esm/svg/svgStyles.js +96 -0
  105. package/dist/esm/text/AreaText.js +190 -0
  106. package/dist/esm/text/PathText.js +111 -0
  107. package/dist/esm/text/PointText.js +92 -0
  108. package/dist/esm/text/TextItem.js +538 -0
  109. package/dist/esm/text/TextRange.js +169 -0
  110. package/dist/esm/text/TextStory.js +394 -0
  111. package/dist/esm/text/areaLayout.js +439 -0
  112. package/dist/esm/text/layout.js +265 -0
  113. package/dist/esm/text/measure.js +57 -0
  114. package/dist/esm/text/pathLayout.js +93 -0
  115. package/dist/esm/tool/Tool.js +284 -0
  116. package/dist/esm/tool/ToolEvent.js +232 -0
  117. package/dist/esm/util/Formatter.js +57 -0
  118. package/dist/esm/util/collisions.js +216 -0
  119. package/dist/esm/util/list.js +110 -0
  120. package/dist/esm/util/numerical.js +656 -0
  121. package/dist/esm/util/object.js +81 -0
  122. package/dist/esm/util/string.js +29 -0
  123. package/dist/esm/util/uid.js +31 -0
  124. package/dist/esm/values/arcs.js +243 -0
  125. package/dist/esm/values/curve.js +975 -0
  126. package/dist/esm/values/fit.js +290 -0
  127. package/dist/esm/values/index.js +23 -0
  128. package/dist/esm/values/intersections.js +869 -0
  129. package/dist/esm/values/matrix.js +114 -0
  130. package/dist/esm/values/path.js +174 -0
  131. package/dist/esm/values/profile.js +221 -0
  132. package/dist/esm/values/region.js +63 -0
  133. package/dist/esm/values/smooth.js +248 -0
  134. package/dist/esm/values/svg.js +287 -0
  135. package/dist/esm/view/CanvasView.js +106 -0
  136. package/dist/esm/view/View.js +775 -0
  137. package/dist/esm/view/input.js +527 -0
  138. package/dist/paper-full.js +32941 -26371
  139. package/dist/paper-full.min.js +36 -31
  140. package/dist/paper-hosted.js +33623 -27236
  141. package/dist/paper-hosted.min.js +37 -0
  142. package/dist/paper-slim.js +28581 -0
  143. package/dist/paper-slim.min.js +17 -0
  144. package/dist/types/anim/Tween.d.ts +164 -0
  145. package/dist/types/basic/Line.d.ts +136 -0
  146. package/dist/types/basic/Matrix.d.ts +387 -0
  147. package/dist/types/basic/Point.d.ts +781 -0
  148. package/dist/types/basic/Rectangle.d.ts +550 -0
  149. package/dist/types/basic/Size.d.ts +457 -0
  150. package/dist/types/boolean/graph.d.ts +123 -0
  151. package/dist/types/boolean/index.d.ts +74 -0
  152. package/dist/types/boolean/operations.d.ts +9 -0
  153. package/dist/types/boolean/split.d.ts +19 -0
  154. package/dist/types/canvas/blendModes.d.ts +18 -0
  155. package/dist/types/canvas/canvasProvider.d.ts +32 -0
  156. package/dist/types/constants.d.ts +112 -0
  157. package/dist/types/core/Base.d.ts +50 -0
  158. package/dist/types/core/Emitter.d.ts +49 -0
  159. package/dist/types/core/features.d.ts +41 -0
  160. package/dist/types/core/serialization.d.ts +44 -0
  161. package/dist/types/core.d.ts +18 -0
  162. package/dist/types/dom/domElement.d.ts +33 -0
  163. package/dist/types/dom/domEvent.d.ts +29 -0
  164. package/dist/types/env.d.ts +26 -0
  165. package/dist/types/event/DrawEvent.d.ts +27 -0
  166. package/dist/types/event/Event.d.ts +47 -0
  167. package/dist/types/event/Key.d.ts +82 -0
  168. package/dist/types/event/KeyEvent.d.ts +35 -0
  169. package/dist/types/event/MouseEvent.d.ts +78 -0
  170. package/dist/types/hosted/HostItem.d.ts +26 -0
  171. package/dist/types/hosted/Hosting.d.ts +273 -0
  172. package/dist/types/hosted/index.d.ts +10 -0
  173. package/dist/types/index.d.ts +64 -0
  174. package/dist/types/internal.d.ts +101 -0
  175. package/dist/types/item/Effect.d.ts +128 -0
  176. package/dist/types/item/EffectInstance.d.ts +81 -0
  177. package/dist/types/item/Group.d.ts +225 -0
  178. package/dist/types/item/HitResult.d.ts +94 -0
  179. package/dist/types/item/Item.d.ts +2927 -0
  180. package/dist/types/item/ItemDefinition.d.ts +25 -0
  181. package/dist/types/item/Layer.d.ts +80 -0
  182. package/dist/types/item/Project.d.ts +748 -0
  183. package/dist/types/item/Raster.d.ts +431 -0
  184. package/dist/types/item/Shape.d.ts +219 -0
  185. package/dist/types/item/SymbolDefinition.d.ts +98 -0
  186. package/dist/types/item/SymbolItem.d.ts +92 -0
  187. package/dist/types/item/bounds.d.ts +56 -0
  188. package/dist/types/item/draw.d.ts +23 -0
  189. package/dist/types/item/effects.d.ts +22 -0
  190. package/dist/types/item/expand.d.ts +7 -0
  191. package/dist/types/item/hitTest.d.ts +10 -0
  192. package/dist/types/item/hosting.d.ts +20 -0
  193. package/dist/types/item/props.d.ts +35 -0
  194. package/dist/types/item/query.d.ts +14 -0
  195. package/dist/types/item/sampling.d.ts +5 -0
  196. package/dist/types/item/transform.d.ts +3 -0
  197. package/dist/types/net/http.d.ts +6 -0
  198. package/dist/types/node/CanvasAdapter.d.ts +19 -0
  199. package/dist/types/node/index.d.ts +60 -0
  200. package/dist/types/node/peers.d.ts +2 -0
  201. package/dist/types/offset/curves.d.ts +22 -0
  202. package/dist/types/offset/index.d.ts +65 -0
  203. package/dist/types/offset/offset.d.ts +18 -0
  204. package/dist/types/offset/outline.d.ts +14 -0
  205. package/dist/types/offset/pen.d.ts +36 -0
  206. package/dist/types/offset/profile.d.ts +37 -0
  207. package/dist/types/offset/round.d.ts +18 -0
  208. package/dist/types/offset/sweep.d.ts +44 -0
  209. package/dist/types/paperscript/PaperScript.d.ts +114 -0
  210. package/dist/types/paperscript/autoload.d.ts +1 -0
  211. package/dist/types/paperscript/index.d.ts +7 -0
  212. package/dist/types/path/CompoundPath.d.ts +183 -0
  213. package/dist/types/path/Curve.d.ts +567 -0
  214. package/dist/types/path/CurveLocation.d.ts +164 -0
  215. package/dist/types/path/Path.d.ts +1361 -0
  216. package/dist/types/path/PathFlattener.d.ts +48 -0
  217. package/dist/types/path/PathItem.d.ts +1190 -0
  218. package/dist/types/path/Segment.d.ts +335 -0
  219. package/dist/types/path/SegmentPoint.d.ts +1 -0
  220. package/dist/types/path/StrokeProfile.d.ts +74 -0
  221. package/dist/types/path/StrokeProfileStop.d.ts +110 -0
  222. package/dist/types/path/boolean.d.ts +24 -0
  223. package/dist/types/path/bounds.d.ts +24 -0
  224. package/dist/types/path/crossing.d.ts +2 -0
  225. package/dist/types/path/draw.d.ts +6 -0
  226. package/dist/types/path/hitTest.d.ts +8 -0
  227. package/dist/types/path/offset.d.ts +14 -0
  228. package/dist/types/path/shapes.d.ts +20 -0
  229. package/dist/types/path/smooth.d.ts +18 -0
  230. package/dist/types/path/values.d.ts +8 -0
  231. package/dist/types/scope/PaperScope.d.ts +182 -0
  232. package/dist/types/scope/PaperScopeItem.d.ts +26 -0
  233. package/dist/types/smoothing/index.d.ts +26 -0
  234. package/dist/types/style/Color.d.ts +829 -0
  235. package/dist/types/style/Gradient.d.ts +130 -0
  236. package/dist/types/style/GradientStop.d.ts +126 -0
  237. package/dist/types/style/PatternDefinition.d.ts +185 -0
  238. package/dist/types/style/Style.d.ts +757 -0
  239. package/dist/types/svg/index.d.ts +14 -0
  240. package/dist/types/svg/svgElement.d.ts +32 -0
  241. package/dist/types/svg/svgExport.d.ts +19 -0
  242. package/dist/types/svg/svgImport.d.ts +13 -0
  243. package/dist/types/svg/svgStyles.d.ts +20 -0
  244. package/dist/types/text/AreaText.d.ts +104 -0
  245. package/dist/types/text/PathText.d.ts +78 -0
  246. package/dist/types/text/PointText.d.ts +50 -0
  247. package/dist/types/text/TextItem.d.ts +163 -0
  248. package/dist/types/text/TextRange.d.ts +98 -0
  249. package/dist/types/text/TextStory.d.ts +119 -0
  250. package/dist/types/text/areaLayout.d.ts +3 -0
  251. package/dist/types/text/layout.d.ts +43 -0
  252. package/dist/types/text/measure.d.ts +7 -0
  253. package/dist/types/text/pathLayout.d.ts +3 -0
  254. package/dist/types/tool/Tool.d.ts +356 -0
  255. package/dist/types/tool/ToolEvent.d.ts +134 -0
  256. package/dist/types/util/Formatter.d.ts +34 -0
  257. package/dist/types/util/collisions.d.ts +77 -0
  258. package/dist/types/util/list.d.ts +23 -0
  259. package/dist/types/util/numerical.d.ts +196 -0
  260. package/dist/types/util/object.d.ts +19 -0
  261. package/dist/types/util/string.d.ts +12 -0
  262. package/dist/types/util/uid.d.ts +7 -0
  263. package/dist/types/values/arcs.d.ts +10 -0
  264. package/dist/types/values/curve.d.ts +42 -0
  265. package/dist/types/values/fit.d.ts +26 -0
  266. package/dist/types/values/index.d.ts +10 -0
  267. package/dist/types/values/intersections.d.ts +11 -0
  268. package/dist/types/values/matrix.d.ts +19 -0
  269. package/dist/types/values/path.d.ts +26 -0
  270. package/dist/types/values/profile.d.ts +41 -0
  271. package/dist/types/values/region.d.ts +13 -0
  272. package/dist/types/values/smooth.d.ts +39 -0
  273. package/dist/types/values/svg.d.ts +47 -0
  274. package/dist/types/view/CanvasView.d.ts +37 -0
  275. package/dist/types/view/View.d.ts +700 -0
  276. package/dist/types/view/input.d.ts +28 -0
  277. package/package.json +89 -59
  278. package/dist/docs/assets/css/docs.css +0 -414
  279. package/dist/docs/assets/js/codemirror.js +0 -4
  280. package/dist/docs/assets/js/docs.js +0 -493
  281. package/dist/docs/assets/js/jquery.js +0 -6
  282. package/dist/docs/assets/js/paper.js +0 -27591
  283. package/dist/docs/classes/AreaText.html +0 -9186
  284. package/dist/docs/classes/ChangeFlag.html +0 -385
  285. package/dist/docs/classes/Color.html +0 -2402
  286. package/dist/docs/classes/CompoundPath.html +0 -10018
  287. package/dist/docs/classes/Curve.html +0 -2326
  288. package/dist/docs/classes/CurveLocation.html +0 -673
  289. package/dist/docs/classes/DrawEvent.html +0 -69
  290. package/dist/docs/classes/Effect.html +0 -434
  291. package/dist/docs/classes/EffectInstance.html +0 -304
  292. package/dist/docs/classes/Event.html +0 -177
  293. package/dist/docs/classes/Gradient.html +0 -241
  294. package/dist/docs/classes/GradientStop.html +0 -274
  295. package/dist/docs/classes/Group.html +0 -7688
  296. package/dist/docs/classes/HitResult.html +0 -241
  297. package/dist/docs/classes/HostItem.html +0 -7314
  298. package/dist/docs/classes/Item.html +0 -7427
  299. package/dist/docs/classes/Key.html +0 -140
  300. package/dist/docs/classes/KeyEvent.html +0 -309
  301. package/dist/docs/classes/Layer.html +0 -7671
  302. package/dist/docs/classes/Matrix.html +0 -1745
  303. package/dist/docs/classes/MouseEvent.html +0 -356
  304. package/dist/docs/classes/PaperScope.html +0 -548
  305. package/dist/docs/classes/PaperScript.html +0 -204
  306. package/dist/docs/classes/Path.html +0 -13007
  307. package/dist/docs/classes/PathItem.html +0 -9780
  308. package/dist/docs/classes/PathText.html +0 -9056
  309. package/dist/docs/classes/PatternDefinition.html +0 -367
  310. package/dist/docs/classes/Point.html +0 -2860
  311. package/dist/docs/classes/PointText.html +0 -8967
  312. package/dist/docs/classes/Project.html +0 -1774
  313. package/dist/docs/classes/Raster.html +0 -8547
  314. package/dist/docs/classes/Rectangle.html +0 -1698
  315. package/dist/docs/classes/Segment.html +0 -1017
  316. package/dist/docs/classes/Shape.html +0 -8048
  317. package/dist/docs/classes/Size.html +0 -1915
  318. package/dist/docs/classes/StrokeProfileStop.html +0 -346
  319. package/dist/docs/classes/Style.html +0 -1765
  320. package/dist/docs/classes/SymbolDefinition.html +0 -338
  321. package/dist/docs/classes/SymbolItem.html +0 -7477
  322. package/dist/docs/classes/TextItem.html +0 -8810
  323. package/dist/docs/classes/TextRange.html +0 -186
  324. package/dist/docs/classes/TextStory.html +0 -355
  325. package/dist/docs/classes/Tool.html +0 -888
  326. package/dist/docs/classes/ToolEvent.html +0 -525
  327. package/dist/docs/classes/Tween.html +0 -390
  328. package/dist/docs/classes/View.html +0 -2108
  329. package/dist/docs/classes/global.html +0 -426
  330. package/dist/docs/classes/index.html +0 -88
  331. package/dist/docs/index.html +0 -11
  332. package/dist/node/browser.js +0 -15
  333. package/dist/node/canvas.js +0 -68
  334. package/dist/node/extend.js +0 -156
  335. package/dist/node/self.js +0 -67
  336. package/dist/paper-core.d.ts +0 -1
  337. package/dist/paper-core.js +0 -25636
  338. package/dist/paper-core.min.js +0 -32
  339. package/dist/paper.d.ts +0 -10481
  340. package/examples/Animated/AnimatedStar.html +0 -53
  341. package/examples/Animated/BooleanOperations.html +0 -115
  342. package/examples/Animated/CandyCrash.html +0 -151
  343. package/examples/Animated/Extruded.html +0 -50
  344. package/examples/Animated/Lines.html +0 -53
  345. package/examples/Animated/Smoothing.html +0 -70
  346. package/examples/Animated/Space.html +0 -86
  347. package/examples/Animated/SpaceUsingShapes.html +0 -79
  348. package/examples/Games/Paperoids.html +0 -569
  349. package/examples/JSON/Circle Testing.html +0 -34
  350. package/examples/JSON/Compound Path.html +0 -25
  351. package/examples/JSON/Empty Path Testing.html +0 -31
  352. package/examples/JSON/Gradients.html +0 -34
  353. package/examples/JSON/Group Transform.html +0 -28
  354. package/examples/JSON/Line Testing.html +0 -44
  355. package/examples/JSON/Random Path Testing.html +0 -42
  356. package/examples/JSON/Raster.html +0 -29
  357. package/examples/JSON/Rect and Attribute Testing.html +0 -56
  358. package/examples/JSON/Rotated Primitives.html +0 -55
  359. package/examples/JSON/Selection.html +0 -43
  360. package/examples/JSON/Shapes.html +0 -54
  361. package/examples/JSON/Symbols.html +0 -30
  362. package/examples/JSON/Text Testing.html +0 -38
  363. package/examples/JSON/Tiger.html +0 -19
  364. package/examples/JSON/Transform Test 1.html +0 -32
  365. package/examples/JSON/Transform Test 2.html +0 -30
  366. package/examples/Node.js/AnimatedStar.js +0 -52
  367. package/examples/Node.js/BooleanOperations.js +0 -36
  368. package/examples/Node.js/JSONtoPDF.js +0 -20
  369. package/examples/Node.js/Raster.js +0 -32
  370. package/examples/Node.js/RasterRemote.js +0 -33
  371. package/examples/Node.js/SvgExport.js +0 -52
  372. package/examples/Node.js/SvgImport.js +0 -23
  373. package/examples/Node.js/Tadpoles.js +0 -16
  374. package/examples/Node.js/Tadpoles.pjs +0 -278
  375. package/examples/Node.js/in.json +0 -1
  376. package/examples/Node.js/in.svg +0 -16
  377. package/examples/Paperjs.org/BooleanOperattions.html +0 -115
  378. package/examples/Paperjs.org/BouncingBalls.html +0 -103
  379. package/examples/Paperjs.org/Chain.html +0 -54
  380. package/examples/Paperjs.org/DivisionRaster.html +0 -72
  381. package/examples/Paperjs.org/FutureSplash.html +0 -122
  382. package/examples/Paperjs.org/HitTesting.html +0 -103
  383. package/examples/Paperjs.org/InteractiveTiger.html +0 -777
  384. package/examples/Paperjs.org/LiveEffects.html +0 -366
  385. package/examples/Paperjs.org/MetaBalls.html +0 -132
  386. package/examples/Paperjs.org/NyanRainbow.html +0 -202
  387. package/examples/Paperjs.org/Offsetting.html +0 -379
  388. package/examples/Paperjs.org/PathIntersections.html +0 -76
  389. package/examples/Paperjs.org/Qbertify.html +0 -146
  390. package/examples/Paperjs.org/RadialRainbows.html +0 -80
  391. package/examples/Paperjs.org/RoundedRectangles.html +0 -41
  392. package/examples/Paperjs.org/SatieLikedToDraw.html +0 -140
  393. package/examples/Paperjs.org/Simplify.html +0 -63
  394. package/examples/Paperjs.org/SpiralRaster.html +0 -120
  395. package/examples/Paperjs.org/StrokeProfiles.html +0 -706
  396. package/examples/Paperjs.org/Tadpoles.html +0 -283
  397. package/examples/Paperjs.org/Voronoi.html +0 -134
  398. package/examples/Rasters/PhyllotaxisRaster.html +0 -96
  399. package/examples/Rasters/Raster.html +0 -34
  400. package/examples/Rasters/RotationRaster.html +0 -44
  401. package/examples/Rasters/Smoothing.html +0 -36
  402. package/examples/SVG Export/Circle Testing.html +0 -32
  403. package/examples/SVG Export/Clipping.html +0 -17
  404. package/examples/SVG Export/Compound Path.html +0 -22
  405. package/examples/SVG Export/Empty Path Testing.html +0 -28
  406. package/examples/SVG Export/Gradients.html +0 -52
  407. package/examples/SVG Export/Group Transform.html +0 -25
  408. package/examples/SVG Export/Line Testing.html +0 -41
  409. package/examples/SVG Export/Random Path Testing.html +0 -39
  410. package/examples/SVG Export/Raster.html +0 -21
  411. package/examples/SVG Export/Rect and Attribute Testing.html +0 -53
  412. package/examples/SVG Export/Rotated Primitives.html +0 -80
  413. package/examples/SVG Export/Shapes.html +0 -58
  414. package/examples/SVG Export/Symbols.html +0 -27
  415. package/examples/SVG Export/Text Testing.html +0 -45
  416. package/examples/SVG Export/Tiger.html +0 -23
  417. package/examples/SVG Export/Transform Test 1.html +0 -29
  418. package/examples/SVG Export/Transform Test 2.html +0 -27
  419. package/examples/SVG Import/Arcs.html +0 -78
  420. package/examples/SVG Import/Butterfly.html +0 -223
  421. package/examples/SVG Import/Circle and Ellipse Testing.html +0 -26
  422. package/examples/SVG Import/Clipping.html +0 -100
  423. package/examples/SVG Import/From File.html +0 -30
  424. package/examples/SVG Import/Gradient.html +0 -138
  425. package/examples/SVG Import/Gradients.html +0 -30
  426. package/examples/SVG Import/Inkscape Pivot.html +0 -52
  427. package/examples/SVG Import/Inkscape.html +0 -88
  428. package/examples/SVG Import/Line Testing.html +0 -24
  429. package/examples/SVG Import/MoreGradients.html +0 -107
  430. package/examples/SVG Import/Multiple Paths Test 1.html +0 -42
  431. package/examples/SVG Import/Multiple Paths Test 2.html +0 -33
  432. package/examples/SVG Import/Nested Groups Test.html +0 -78
  433. package/examples/SVG Import/Polybezier.html +0 -43
  434. package/examples/SVG Import/Rect Testing.html +0 -25
  435. package/examples/SVG Import/Symbols.html +0 -24
  436. package/examples/SVG Import/Testing.html +0 -40
  437. package/examples/SVG Import/Text Testing.html +0 -19
  438. package/examples/SVG Import/Tiger.html +0 -742
  439. package/examples/SVG Import/Transform Testing.html +0 -22
  440. package/examples/SVG Import/Viewbox.html +0 -38
  441. package/examples/Scripts/Arcs.html +0 -39
  442. package/examples/Scripts/AreaText.html +0 -65
  443. package/examples/Scripts/BlendModes.html +0 -77
  444. package/examples/Scripts/BooleanOperations.html +0 -937
  445. package/examples/Scripts/CompoundPath.html +0 -19
  446. package/examples/Scripts/CurveTimeParameterization.html +0 -61
  447. package/examples/Scripts/HslColor.html +0 -53
  448. package/examples/Scripts/PathStructure.html +0 -82
  449. package/examples/Scripts/PathTangents.html +0 -73
  450. package/examples/Scripts/PathText.html +0 -48
  451. package/examples/Scripts/Patterns.html +0 -57
  452. package/examples/Scripts/Resize.html +0 -42
  453. package/examples/Scripts/RoundRectangle.html +0 -28
  454. package/examples/Scripts/Shapes.html +0 -54
  455. package/examples/Scripts/StrokeBounds.html +0 -101
  456. package/examples/Scripts/StrokeScaling.html +0 -65
  457. package/examples/Scripts/TextRanges.html +0 -51
  458. package/examples/Tools/BezierTool.html +0 -90
  459. package/examples/Tools/Circles.html +0 -28
  460. package/examples/Tools/Clouds.html +0 -35
  461. package/examples/Tools/DrippingBrush.html +0 -73
  462. package/examples/Tools/FancyBrush.html +0 -82
  463. package/examples/Tools/Grid.html +0 -44
  464. package/examples/Tools/MultiLines.html +0 -44
  465. package/examples/Tools/MultipleTools.html +0 -44
  466. package/examples/Tools/PathEditing.html +0 -95
  467. package/examples/Tools/SquareRounded.html +0 -76
  468. package/examples/Tools/Stars.html +0 -38
  469. package/examples/Tools/Vektor.html +0 -200
  470. package/examples/Tools/Wave.html +0 -50
  471. package/examples/Tools/WormFarm.html +0 -88
  472. package/examples/Worker/Main.html +0 -53
  473. package/examples/Worker/Worker.js +0 -14
  474. package/examples/css/style.css +0 -12
@@ -0,0 +1,829 @@
1
+ import { Base, Gradient, Matrix, PatternDefinition, Point } from '../internal.ts';
2
+ import type { PointLike } from '../basic/Point.ts';
3
+ import type { Item } from '../item/Item.ts';
4
+ import type { GradientLike } from './Gradient.ts';
5
+ import type { GradientStopLike } from './GradientStop.ts';
6
+ import type { JSONDictionary, JSONOptions } from '../core/serialization.ts';
7
+ export type ColorSpace = 'rgb' | 'gray' | 'hsb' | 'hsl';
8
+ export type ColorType = ColorSpace | 'gradient' | 'pattern';
9
+ /**
10
+ * What a color can be passed as, where a function takes one: a color, a CSS
11
+ * string, a gray value, an array of components, or an object describing the
12
+ * components, see the {@link Color} constructors.
13
+ */
14
+ export type ColorLike = Color | string | number | number[] | ColorProps | Gradient | PatternDefinition;
15
+ type ColorProps = {
16
+ red?: number;
17
+ green?: number;
18
+ blue?: number;
19
+ alpha?: number;
20
+ } | {
21
+ gray: number;
22
+ alpha?: number;
23
+ } | {
24
+ hue: number;
25
+ saturation?: number;
26
+ brightness?: number;
27
+ alpha?: number;
28
+ } | {
29
+ hue: number;
30
+ saturation?: number;
31
+ lightness?: number;
32
+ alpha?: number;
33
+ } | {
34
+ pattern: PatternDefinition | Item;
35
+ matrix?: Matrix;
36
+ alpha?: number;
37
+ } | {
38
+ gradient?: GradientLike;
39
+ stops?: GradientStopLike[];
40
+ radial?: boolean;
41
+ origin?: PointLike;
42
+ destination?: PointLike;
43
+ highlight?: PointLike | null;
44
+ aspect?: number;
45
+ alpha?: number;
46
+ };
47
+ type ColorComponent = number | Gradient | Point | PatternDefinition | Matrix | null;
48
+ interface ColorOwner {
49
+ [key: string]: any;
50
+ _changed(flags: number): void;
51
+ }
52
+ /**
53
+ * All properties and functions that expect color values in the form
54
+ * of instances of Color objects, also accept named colors and hex values as
55
+ * strings which are then converted to instances of
56
+ * {@link Color} internally.
57
+ *
58
+ * @classexample {@paperscript}
59
+ * // Named color values:
60
+ *
61
+ * // Create a circle shaped path at {x: 80, y: 50}
62
+ * // with a radius of 30.
63
+ * var circle = Path.circle(new Point(80, 50), 30);
64
+ *
65
+ * // Pass a color name to the fillColor property, which is internally
66
+ * // converted to a Color.
67
+ * circle.fillColor = 'green';
68
+ *
69
+ * @classexample {@paperscript}
70
+ * // Hex color values:
71
+ *
72
+ * // Create a circle shaped path at {x: 80, y: 50}
73
+ * // with a radius of 30.
74
+ * var circle = Path.circle(new Point(80, 50), 30);
75
+ *
76
+ * // Pass a hex string to the fillColor property, which is internally
77
+ * // converted to a Color.
78
+ * circle.fillColor = '#ff0000';
79
+ */
80
+ export declare class Color extends Base {
81
+ #private;
82
+ _canvasStyle: string | CanvasGradient | CanvasPattern | null;
83
+ /**
84
+ * Creates a RGB Color object.
85
+ *
86
+ * @param red the amount of red in the color as a value between
87
+ * `0` and `1`
88
+ * @param green the amount of green in the color as a value
89
+ * between `0` and `1`
90
+ * @param blue the amount of blue in the color as a value
91
+ * between `0` and `1`
92
+ * @param alpha the alpha of the color as a value between `0`
93
+ * and `1`
94
+ *
95
+ * @example {@paperscript}
96
+ * // Creating a RGB Color:
97
+ *
98
+ * // Create a circle shaped path at {x: 80, y: 50}
99
+ * // with a radius of 30:
100
+ * var circle = Path.circle(new Point(80, 50), 30);
101
+ *
102
+ * // 100% red, 0% blue, 50% blue:
103
+ * circle.fillColor = new Color(1, 0, 0.5);
104
+ */
105
+ constructor(red: number, green: number, blue: number, alpha?: number);
106
+ /**
107
+ * Creates a gray Color object.
108
+ *
109
+ * @param gray the amount of gray in the color as a value
110
+ * between `0` and `1`
111
+ * @param alpha the alpha of the color as a value between `0`
112
+ * and `1`
113
+ *
114
+ * @example {@paperscript}
115
+ * // Creating a gray Color:
116
+ *
117
+ * // Create a circle shaped path at {x: 80, y: 50}
118
+ * // with a radius of 30:
119
+ * var circle = Path.circle(new Point(80, 50), 30);
120
+ *
121
+ * // Create a GrayColor with 50% gray:
122
+ * circle.fillColor = new Color(0.5);
123
+ */
124
+ constructor(gray: number, alpha?: number);
125
+ /**
126
+ * Creates a HSB, HSL, gradient or pattern Color object from the
127
+ * properties of the provided object:
128
+ *
129
+ * @option hsb.hue {Number} the hue of the color as a value in degrees
130
+ * between `0` and `360`
131
+ * @option hsb.saturation {Number} the saturation of the color as a
132
+ * value between `0` and `1`
133
+ * @option hsb.brightness {Number} the brightness of the color as a
134
+ * value between `0` and `1`
135
+ * @option hsb.alpha {Number} the alpha of the color as a value between
136
+ * `0` and `1`
137
+ *
138
+ * @option hsl.hue {Number} the hue of the color as a value in degrees
139
+ * between `0` and `360`
140
+ * @option hsl.saturation {Number} the saturation of the color as a
141
+ * value between `0` and `1`
142
+ * @option hsl.lightness {Number} the lightness of the color as a value
143
+ * between `0` and `1`
144
+ * @option hsl.alpha {Number} the alpha of the color as a value between
145
+ * `0` and `1`
146
+ *
147
+ * @option gradient.gradient {Gradient} the gradient object that
148
+ * describes the color stops and type of gradient to be used
149
+ * @option gradient.origin {Point} the origin point of the gradient
150
+ * @option gradient.destination {Point} the destination point of the
151
+ * gradient
152
+ * @option gradient.stops {GradientStop[]} the gradient stops describing
153
+ * the gradient, as an alternative to providing a gradient object
154
+ * @option gradient.radial {Boolean} controls whether the gradient is
155
+ * radial, as an alternative to providing a gradient object
156
+ *
157
+ * @option pattern.pattern {PatternDefinition} the pattern whose tiles
158
+ * the color repeats
159
+ * @option pattern.matrix {Matrix} the matrix that places the tiles in
160
+ * the item's coordinates
161
+ *
162
+ * @param object an object describing the components and
163
+ * properties of the color
164
+ *
165
+ * @example {@paperscript}
166
+ * // Creating a HSB Color:
167
+ *
168
+ * // Create a circle shaped path at {x: 80, y: 50}
169
+ * // with a radius of 30:
170
+ * var circle = Path.circle(new Point(80, 50), 30);
171
+ *
172
+ * // Create an HSB Color with a hue of 90 degrees, a saturation
173
+ * // 100% and a brightness of 100%:
174
+ * circle.fillColor = { hue: 90, saturation: 1, brightness: 1 };
175
+ *
176
+ * @example {@paperscript}
177
+ * // Creating a HSL Color:
178
+ *
179
+ * // Create a circle shaped path at {x: 80, y: 50}
180
+ * // with a radius of 30:
181
+ * var circle = Path.circle(new Point(80, 50), 30);
182
+ *
183
+ * // Create an HSL Color with a hue of 90 degrees, a saturation
184
+ * // 100% and a lightness of 50%:
185
+ * circle.fillColor = { hue: 90, saturation: 1, lightness: 0.5 };
186
+ *
187
+ * @example {@paperscript height=200}
188
+ * // Creating a gradient color from an object literal:
189
+ *
190
+ * // Define two points which we will be using to construct
191
+ * // the path and to position the gradient color:
192
+ * var topLeft = view.center - [80, 80];
193
+ * var bottomRight = view.center + [80, 80];
194
+ *
195
+ * var path = Path.rectangle({
196
+ * topLeft: topLeft,
197
+ * bottomRight: bottomRight,
198
+ * // Fill the path with a gradient of three color stops
199
+ * // that runs between the two points we defined earlier:
200
+ * fillColor: {
201
+ * stops: ['yellow', 'red', 'blue'],
202
+ * origin: topLeft,
203
+ * destination: bottomRight
204
+ * }
205
+ * });
206
+ */
207
+ constructor(object: ColorProps);
208
+ /**
209
+ * Creates a Color object from a CSS string. All common CSS color string
210
+ * formats are supported:
211
+ * - Named colors (e.g. `'red'`, `'fuchsia'`, …)
212
+ * - Hex strings (`'#ffff00'`, `'#ff0'`, …)
213
+ * - RGB strings (`'rgb(255, 128, 0)'`, `'rgba(255, 128, 0, 0.5)'`, …)
214
+ * - HSL strings (`'hsl(180deg, 20%, 50%)'`,
215
+ * `'hsla(3.14rad, 20%, 50%, 0.5)'`, …)
216
+ *
217
+ * @param color the color's CSS string representation
218
+ *
219
+ * @example {@paperscript}
220
+ * var circle = Path.circle({
221
+ * center: [80, 50],
222
+ * radius: 30,
223
+ * fillColor: new Color('rgba(255, 255, 0, 0.5)')
224
+ * });
225
+ */
226
+ constructor(color: string);
227
+ /**
228
+ * Creates a gradient Color object.
229
+ *
230
+ * @param gradient the gradient that describes the color stops and the
231
+ * type of gradient
232
+ * @param origin the origin point of the gradient
233
+ * @param destination the destination point of the gradient
234
+ * @param highlight the highlight point of a radial gradient
235
+ * @param [aspect=1] the aspect of a radial gradient, see {@link #aspect}
236
+ *
237
+ * @example {@paperscript height=200}
238
+ * // Applying a linear gradient color containing evenly distributed
239
+ * // color stops:
240
+ *
241
+ * // Define two points which we will be using to construct
242
+ * // the path and to position the gradient color:
243
+ * var topLeft = view.center - [80, 80];
244
+ * var bottomRight = view.center + [80, 80];
245
+ *
246
+ * // Create a rectangle shaped path between
247
+ * // the topLeft and bottomRight points:
248
+ * var path = Path.rectangle(topLeft, bottomRight);
249
+ *
250
+ * // Create the gradient, passing it an array of colors to be converted
251
+ * // to evenly distributed color stops:
252
+ * var gradient = new Gradient(['yellow', 'red', 'blue']);
253
+ *
254
+ * // Have the gradient color run between the topLeft and
255
+ * // bottomRight points we defined earlier:
256
+ * var gradientColor = new Color(gradient, topLeft, bottomRight);
257
+ *
258
+ * // Set the fill color of the path to the gradient color:
259
+ * path.fillColor = gradientColor;
260
+ *
261
+ * @example {@paperscript height=200}
262
+ * // Applying a radial gradient color containing unevenly distributed
263
+ * // color stops:
264
+ *
265
+ * // Create a circle shaped path at the center of the view
266
+ * // with a radius of 80:
267
+ * var path = Path.circle({
268
+ * center: view.center,
269
+ * radius: 80
270
+ * });
271
+ *
272
+ * // The stops array: yellow mixes with red between 0 and 15%,
273
+ * // 15% to 30% is pure red, red mixes with black between 30% to 100%:
274
+ * var stops = [
275
+ * ['yellow', 0],
276
+ * ['red', 0.15],
277
+ * ['red', 0.3],
278
+ * ['black', 0.9]
279
+ * ];
280
+ *
281
+ * // Create a radial gradient using the color stops array:
282
+ * var gradient = new Gradient(stops, true);
283
+ *
284
+ * // We will use the center point of the circle shaped path as
285
+ * // the origin point for our gradient color
286
+ * var from = path.position;
287
+ *
288
+ * // The destination point of the gradient color will be the
289
+ * // center point of the path + 80pt in horizontal direction:
290
+ * var to = path.position + [80, 0];
291
+ *
292
+ * // Create the gradient color:
293
+ * var gradientColor = new Color(gradient, from, to);
294
+ *
295
+ * // Set the fill color of the path to the gradient color:
296
+ * path.fillColor = gradientColor;
297
+ */
298
+ constructor(gradient: Gradient, origin: PointLike, destination: PointLike, highlight?: PointLike | null, aspect?: number);
299
+ /**
300
+ * Creates a pattern Color object, which repeats the tiles of the
301
+ * pattern, placed by the matrix in the item's coordinates. As with
302
+ * gradient colors, the matrix is transformed along with the item.
303
+ *
304
+ * @param pattern the pattern whose tiles the color repeats
305
+ * @param matrix the matrix that places the tiles in the item's
306
+ * coordinates
307
+ *
308
+ * @example {@paperscript height=200}
309
+ * // Filling a rectangle with a dotted pattern, and stroking it with
310
+ * // the same pattern, turned by 45 degrees:
311
+ * var dot = Path.circle({
312
+ * center: [4, 4],
313
+ * radius: 2,
314
+ * fillColor: 'black'
315
+ * });
316
+ * var pattern = new PatternDefinition(dot, {
317
+ * size: [8, 8]
318
+ * });
319
+ *
320
+ * var path = Path.rectangle({
321
+ * point: [40, 40],
322
+ * size: [160, 120],
323
+ * strokeWidth: 16
324
+ * });
325
+ * path.fillColor = new Color(pattern);
326
+ * path.strokeColor = new Color(pattern, new Matrix().rotate(45));
327
+ */
328
+ constructor(pattern: PatternDefinition, matrix?: Matrix | null);
329
+ constructor(color?: ColorLike);
330
+ /**
331
+ * Creates a color of the given type from its components, followed by the
332
+ * alpha value if there is one, as JSON stores colors.
333
+ *
334
+ * @param type the type of the color: `'gray'`, `'rgb'`, `'hsb'`, `'hsl'`,
335
+ * `'gradient'` or `'pattern'`
336
+ * @param components the components of the color, followed by its alpha
337
+ */
338
+ constructor(type: ColorType, ...components: (ColorComponent | PointLike | undefined)[]);
339
+ /**
340
+ * Sets the color to the passed values. Note that any sequence of
341
+ * parameters that is supported by the various {@link Color()}
342
+ * constructors also work for calls of `set()`.
343
+ *
344
+ * @param values the values, in any of the forms of the constructors
345
+ * @return
346
+ */
347
+ set(...values: (ColorLike | ColorComponent | PointLike | undefined)[]): this;
348
+ _serialize(options: JSONOptions, dictionary: JSONDictionary): any;
349
+ /**
350
+ * Called by various setters whenever a color value changes
351
+ */
352
+ _changed(): void;
353
+ /**
354
+ * @return the converted components as an array
355
+ */
356
+ _convert(type: ColorType): any[];
357
+ /**
358
+ * Converts the color to another type.
359
+ *
360
+ * @param type the color type to convert to. Possible values:
361
+ * {@values 'rgb', 'gray', 'hsb', 'hsl'}
362
+ * @return the converted color as a new instance
363
+ */
364
+ convert(type: ColorSpace): Color;
365
+ /**
366
+ * The type of the color as a string.
367
+ *
368
+ * @values 'rgb', 'gray', 'hsb', 'hsl', 'gradient', 'pattern'
369
+ *
370
+ * @example
371
+ * var color = new Color(1, 0, 0);
372
+ * console.log(color.type); // 'rgb'
373
+ */
374
+ get type(): ColorType;
375
+ set type(type: ColorType);
376
+ /**
377
+ * The color components that define the color, including the alpha value
378
+ * if defined.
379
+ */
380
+ get components(): ColorComponent[];
381
+ /**
382
+ * The color's alpha value as a number between `0` and `1`.
383
+ * All colors of the different subclasses support alpha values.
384
+ *
385
+ * @default 1
386
+ *
387
+ * @example {@paperscript}
388
+ * // A filled path with a half transparent stroke:
389
+ * var circle = Path.circle(new Point(80, 50), 30);
390
+ *
391
+ * // Fill the circle with red and give it a 20pt green stroke:
392
+ * circle.style = {
393
+ * fillColor: 'red',
394
+ * strokeColor: 'green',
395
+ * strokeWidth: 20
396
+ * };
397
+ *
398
+ * // Make the stroke half transparent:
399
+ * circle.strokeColor.alpha = 0.5;
400
+ */
401
+ get alpha(): number;
402
+ set alpha(alpha: number);
403
+ /**
404
+ * Checks if the color has an alpha value.
405
+ *
406
+ * @return {@true if the color has an alpha value}
407
+ */
408
+ hasAlpha(): boolean;
409
+ /**
410
+ * Checks if the component color values of the color are the
411
+ * same as those of the supplied one.
412
+ *
413
+ * @param color the color to compare with
414
+ * @return {@true if the colors are the same}
415
+ */
416
+ equals(color: ColorLike | null | undefined): boolean;
417
+ /**
418
+ * Returns a copy of the color object.
419
+ *
420
+ * @return a copy of the color object
421
+ */
422
+ clone(): Color;
423
+ /**
424
+ * {@grouptitle String Representations}
425
+ * @return a string representation of the color
426
+ */
427
+ toString(): string;
428
+ /**
429
+ * Returns the color as a CSS string.
430
+ *
431
+ * @param hex whether to return the color in hexadecimal
432
+ * representation or as a CSS RGB / RGBA string
433
+ * @return a CSS string representation of the color
434
+ */
435
+ toCSS(hex?: boolean): string;
436
+ _getEllipseMatrix(matrix: Matrix | null | undefined, strokeMatrix: Matrix | null | undefined): Matrix | null;
437
+ toCanvasStyle(ctx: CanvasRenderingContext2D, matrix?: Matrix | null, strokeMatrix?: Matrix | null, isEllipse?: boolean): string | CanvasGradient | CanvasPattern;
438
+ /**
439
+ * Transform the gradient or pattern color by the specified matrix.
440
+ * Radial gradients become ellipses, see {@link #aspect}, and the
441
+ * stripes of linear gradients keep running across them, also when the
442
+ * matrix scales unevenly or shears. Pattern colors transform their
443
+ * {@link #matrix}.
444
+ *
445
+ * @param matrix the matrix to transform the color by
446
+ */
447
+ transform(matrix: Matrix): void;
448
+ /**
449
+ * Returns the passed color if it is one already, or else a new color
450
+ * created from the passed value, as {@link Color()} reads it.
451
+ *
452
+ * @param color the color, or a value describing one
453
+ */
454
+ static from(color: ColorLike): Color;
455
+ /**
456
+ * Returns a color object with random {@link #red}, {@link #green}
457
+ * and {@link #blue} values between `0` and `1`.
458
+ *
459
+ * @return the newly created color object
460
+ *
461
+ * @example {@paperscript}
462
+ * var circle = Path.circle(view.center, 50);
463
+ * // Set a random color as circle fill color.
464
+ * circle.fillColor = Color.random();
465
+ */
466
+ static random(): Color;
467
+ static _setOwner(color: Color, owner: ColorOwner | null | undefined, key?: string | null): Color;
468
+ /**
469
+ * Returns the addition of the supplied value to all components of
470
+ * the color as a new color.
471
+ * The object itself is not modified!
472
+ *
473
+ * @operator
474
+ * @param number the number to add
475
+ * @return the addition of the color and the value as a new
476
+ * color
477
+ *
478
+ * @example
479
+ * var color = new Color(0.5, 0.25, 0);
480
+ * var result = color + 0.25; // PaperScript
481
+ * var result = color.add(0.25); // JavaScript
482
+ * console.log(result); // { red: 0.75, green: 0.5, blue: 0.25 }
483
+ */
484
+ add(number: number): Color;
485
+ /**
486
+ * Returns the addition of the supplied color to the color as a new
487
+ * color.
488
+ * The object itself is not modified!
489
+ *
490
+ * @operator
491
+ * @param color the color to add
492
+ * @return the addition of the two colors as a new color
493
+ *
494
+ * @example
495
+ * var color1 = new Color(0, 1, 1);
496
+ * var color2 = new Color(1, 0, 0);
497
+ * var result = color1 + color2; // PaperScript
498
+ * var result = color1.add(color2); // JavaScript
499
+ * console.log(result); // { red: 1, green: 1, blue: 1 }
500
+ */
501
+ add(color: ColorLike): Color;
502
+ /**
503
+ * Returns the subtraction of the supplied value to all components of
504
+ * the color as a new color.
505
+ * The object itself is not modified!
506
+ *
507
+ * @operator
508
+ * @param number the number to subtract
509
+ * @return the subtraction of the color and the value as a new
510
+ * color
511
+ *
512
+ * @example
513
+ * var color = new Color(0.5, 1, 1);
514
+ * var result = color - 0.5; // PaperScript
515
+ * var result = color.subtract(0.5); // JavaScript
516
+ * console.log(result); // { red: 0, green: 0.5, blue: 0.5 }
517
+ */
518
+ subtract(number: number): Color;
519
+ /**
520
+ * Returns the subtraction of the supplied color to the color as a new
521
+ * color.
522
+ * The object itself is not modified!
523
+ *
524
+ * @operator
525
+ * @param color the color to subtract
526
+ * @return the subtraction of the two colors as a new color
527
+ *
528
+ * @example
529
+ * var color1 = new Color(1, 1, 1);
530
+ * var color2 = new Color(1, 0, 0);
531
+ * var result = color1 - color2; // PaperScript
532
+ * var result = color1.subtract(color2); // JavaScript
533
+ * console.log(result); // { red: 0, green: 1, blue: 1 }
534
+ */
535
+ subtract(color: ColorLike): Color;
536
+ /**
537
+ * Returns the multiplication of the supplied value to all components
538
+ * of the color as a new color.
539
+ * The object itself is not modified!
540
+ *
541
+ * @operator
542
+ * @param number the number to multiply
543
+ * @return the multiplication of the color and the value as a
544
+ * new color
545
+ *
546
+ * @example
547
+ * var color = new Color(0.5, 1, 1);
548
+ * var result = color * 0.5; // PaperScript
549
+ * var result = color.multiply(0.5); // JavaScript
550
+ * console.log(result); // { red: 0.25, green: 0.5, blue: 0.5 }
551
+ */
552
+ multiply(number: number): Color;
553
+ /**
554
+ * Returns the multiplication of the supplied color to the color as a
555
+ * new color.
556
+ * The object itself is not modified!
557
+ *
558
+ * @operator
559
+ * @param color the color to multiply
560
+ * @return the multiplication of the two colors as a new color
561
+ *
562
+ * @example
563
+ * var color1 = new Color(0, 1, 1);
564
+ * var color2 = new Color(0.5, 0, 0.5);
565
+ * var result = color1 * color2; // PaperScript
566
+ * var result = color1.multiply(color2); // JavaScript
567
+ * console.log(result); // { red: 0, green: 0, blue: 0.5 }
568
+ */
569
+ multiply(color: ColorLike): Color;
570
+ /**
571
+ * Returns the division of the supplied value to all components of
572
+ * the color as a new color.
573
+ * The object itself is not modified!
574
+ *
575
+ * @operator
576
+ * @param number the number to divide
577
+ * @return the division of the color and the value as a new
578
+ * color
579
+ *
580
+ * @example
581
+ * var color = new Color(0.5, 1, 1);
582
+ * var result = color / 2; // PaperScript
583
+ * var result = color.divide(2); // JavaScript
584
+ * console.log(result); // { red: 0.25, green: 0.5, blue: 0.5 }
585
+ */
586
+ divide(number: number): Color;
587
+ /**
588
+ * Returns the division of the supplied color to the color as a new
589
+ * color.
590
+ * The object itself is not modified!
591
+ *
592
+ * @operator
593
+ * @param color the color to divide
594
+ * @return the division of the two colors as a new color
595
+ *
596
+ * @example
597
+ * var color1 = new Color(0, 1, 1);
598
+ * var color2 = new Color(0.5, 1, 2);
599
+ * var result = color1 / color2; // PaperScript
600
+ * var result = color1.divide(color2); // JavaScript
601
+ * console.log(result); // { red: 0, green: 1, blue: 0.5 }
602
+ */
603
+ divide(color: ColorLike): Color;
604
+ }
605
+ export interface Color {
606
+ /**
607
+ * {@grouptitle RGB Components}
608
+ *
609
+ * The amount of red in the color as a value between `0` and `1`.
610
+ *
611
+ *
612
+ * @example {@paperscript}
613
+ * // Changing the amount of red in a color:
614
+ * var circle = Path.circle(new Point(80, 50), 30);
615
+ * circle.fillColor = 'blue';
616
+ *
617
+ * // Blue + red = purple:
618
+ * circle.fillColor.red = 1;
619
+ */
620
+ red: number;
621
+ /**
622
+ * The amount of green in the color as a value between `0` and `1`.
623
+ *
624
+ *
625
+ * @example {@paperscript}
626
+ * // Changing the amount of green in a color:
627
+ * var circle = Path.circle(new Point(80, 50), 30);
628
+ *
629
+ * // First we set the fill color to red:
630
+ * circle.fillColor = 'red';
631
+ *
632
+ * // Red + green = yellow:
633
+ * circle.fillColor.green = 1;
634
+ */
635
+ green: number;
636
+ /**
637
+ * The amount of blue in the color as a value between `0` and `1`.
638
+ *
639
+ *
640
+ * @example {@paperscript}
641
+ * // Changing the amount of blue in a color:
642
+ * var circle = Path.circle(new Point(80, 50), 30);
643
+ *
644
+ * // First we set the fill color to red:
645
+ * circle.fillColor = 'red';
646
+ *
647
+ * // Red + blue = purple:
648
+ * circle.fillColor.blue = 1;
649
+ */
650
+ blue: number;
651
+ /**
652
+ * {@grouptitle Gray Components}
653
+ *
654
+ * The amount of gray in the color as a value between `0` and `1`.
655
+ */
656
+ gray: number;
657
+ /**
658
+ * {@grouptitle HSB Components}
659
+ *
660
+ * The hue of the color as a value in degrees between `0` and `360`.
661
+ *
662
+ *
663
+ * @example {@paperscript}
664
+ * // Changing the hue of a color:
665
+ * var circle = Path.circle(new Point(80, 50), 30);
666
+ * circle.fillColor = 'red';
667
+ * circle.fillColor.hue += 30;
668
+ *
669
+ * @example {@paperscript}
670
+ * // Hue cycling:
671
+ *
672
+ * // Create a rectangle shaped path, using the dimensions
673
+ * // of the view:
674
+ * var path = Path.rectangle(view.bounds);
675
+ * path.fillColor = 'red';
676
+ *
677
+ * function onFrame(event) {
678
+ * path.fillColor.hue += 0.5;
679
+ * }
680
+ */
681
+ hue: number;
682
+ /**
683
+ * The saturation of the color as a value between `0` and `1`.
684
+ */
685
+ saturation: number;
686
+ /**
687
+ * The brightness of the color as a value between `0` and `1`.
688
+ */
689
+ brightness: number;
690
+ /**
691
+ * {@grouptitle HSL Components}
692
+ *
693
+ * The lightness of the color as a value between `0` and `1`.
694
+ *
695
+ * Note that all other components are shared with HSB.
696
+ */
697
+ lightness: number;
698
+ /**
699
+ * {@grouptitle Gradient Components}
700
+ *
701
+ * The gradient object describing the type of gradient and the stops.
702
+ */
703
+ gradient: Gradient;
704
+ /**
705
+ * The origin point of the gradient.
706
+ *
707
+ *
708
+ * @example {@paperscript height=200}
709
+ * // Move the origin point of the gradient, by moving your mouse over
710
+ * // the view below:
711
+ *
712
+ * // Create a rectangle shaped path with the same dimensions as
713
+ * // that of the view and fill it with a gradient color:
714
+ * var path = Path.rectangle(view.bounds);
715
+ * var gradient = new Gradient(['yellow', 'red', 'blue']);
716
+ *
717
+ * // Have the gradient color run from the top left point of the view,
718
+ * // to the bottom right point of the view:
719
+ * var from = view.bounds.topLeft;
720
+ * var to = view.bounds.bottomRight;
721
+ * var gradientColor = new Color(gradient, from, to);
722
+ * path.fillColor = gradientColor;
723
+ *
724
+ * function onMouseMove(event) {
725
+ * // Set the origin point of the path's gradient color
726
+ * // to the position of the mouse:
727
+ * path.fillColor.origin = event.point;
728
+ * }
729
+ */
730
+ get origin(): Point;
731
+ set origin(point: PointLike);
732
+ /**
733
+ * The destination point of the gradient.
734
+ *
735
+ *
736
+ * @example {@paperscript height=300}
737
+ * // Move the destination point of the gradient, by moving your mouse
738
+ * // over the view below:
739
+ *
740
+ * // Create a circle shaped path at the center of the view,
741
+ * // using 40% of the height of the view as its radius
742
+ * // and fill it with a radial gradient color:
743
+ * var path = Path.circle({
744
+ * center: view.center,
745
+ * radius: view.bounds.height * 0.4
746
+ * });
747
+ *
748
+ * var gradient = new Gradient(['yellow', 'red', 'black'], true);
749
+ * var from = view.center;
750
+ * var to = view.bounds.bottomRight;
751
+ * var gradientColor = new Color(gradient, from, to);
752
+ * path.fillColor = gradientColor;
753
+ *
754
+ * function onMouseMove(event) {
755
+ * // Set the destination point of the path's gradient color
756
+ * // to the position of the mouse:
757
+ * path.fillColor.destination = event.point;
758
+ * }
759
+ */
760
+ get destination(): Point;
761
+ set destination(point: PointLike);
762
+ /**
763
+ * The highlight point of the gradient.
764
+ *
765
+ *
766
+ * @example {@paperscript height=300}
767
+ * // Create a circle shaped path at the center of the view,
768
+ * // using 40% of the height of the view as its radius
769
+ * // and fill it with a radial gradient color:
770
+ * var path = Path.circle({
771
+ * center: view.center,
772
+ * radius: view.bounds.height * 0.4
773
+ * });
774
+ *
775
+ * path.fillColor = {
776
+ * gradient: {
777
+ * stops: ['yellow', 'red', 'black'],
778
+ * radial: true
779
+ * },
780
+ * origin: path.position,
781
+ * destination: path.bounds.rightCenter
782
+ * };
783
+ *
784
+ * function onMouseMove(event) {
785
+ * // Set the origin highlight of the path's gradient color
786
+ * // to the position of the mouse:
787
+ * path.fillColor.highlight = event.point;
788
+ * }
789
+ */
790
+ get highlight(): Point;
791
+ set highlight(point: PointLike);
792
+ /**
793
+ * The aspect of a radial gradient: its radius across the line from
794
+ * the origin to the destination, as a factor of its radius along it,
795
+ * which makes it an ellipse. Transforming a gradient color sets it, so
796
+ * that the gradient stretches, shears and rotates with its item.
797
+ *
798
+ * @default 1
799
+ *
800
+ * @example {@paperscript height=200}
801
+ * // An elliptical radial gradient, twice as wide as tall:
802
+ * var path = Path.ellipse({
803
+ * center: view.center,
804
+ * radius: [80, 40],
805
+ * fillColor: {
806
+ * gradient: {
807
+ * stops: ['yellow', 'red', 'black'],
808
+ * radial: true
809
+ * },
810
+ * origin: view.center,
811
+ * destination: view.center + [80, 0],
812
+ * aspect: 0.5
813
+ * }
814
+ * });
815
+ */
816
+ aspect: number;
817
+ /**
818
+ * {@grouptitle Pattern Components}
819
+ *
820
+ * The pattern whose tiles the color repeats.
821
+ */
822
+ pattern: PatternDefinition;
823
+ /**
824
+ * The matrix that places the tiles of the pattern in the item's
825
+ * coordinates.
826
+ */
827
+ matrix: Matrix;
828
+ }
829
+ export {};