Guest User

Untitled

a guest
Mar 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. import processing.pdf.*;
  2. HColorPool colors;
  3. HShape a;
  4. HShape b;
  5. HShape c;
  6. HShape d;
  7. HShape e;
  8. HShape f;
  9. HShape g;
  10. HShape h;
  11. HShape r;
  12. HShape j;
  13. HShape k;
  14. HShape l;
  15. HShape m;
  16. HShape n;
  17. HShape o;
  18. HShape p;
  19. HShape q;
  20.  
  21.  
  22. void setup(){
  23. size(1340,700);
  24. H.init(this).background(#000056);
  25. smooth();
  26.  
  27. colors = new HColorPool()
  28. .add(#8e54fa,25)
  29. .add(#8081f9,20)
  30. .add(#4a3dd3,15)
  31. .add(#63fdfa,10)
  32. .add(#f491f4,15)
  33. .add(#fda07c,10)
  34. .add(#eff1e1,5)
  35. ;
  36.  
  37. for (int i = 0; i < 5; ++i) {
  38. a = new HShape("25circle.svg");
  39. a
  40. .enableStyle(false)
  41. // .noStroke()
  42. .strokeJoin(ROUND)
  43. .strokeCap(ROUND)
  44. .strokeWeight(.5)
  45. .rotate( (int)random(360) )
  46. .size( (int)random(10,30) )
  47. .loc( (int)random(width), (int)random(height) )
  48. .anchorAt(H.CENTER)
  49. ;
  50. a.randomColors(colors.fillOnly());
  51. H.add(a);
  52. }
  53.  
  54. for (int i = 0; i < 5; ++i) {
  55. b = new HShape("75circle.svg");
  56. b
  57. .enableStyle(false)
  58. // .noStroke()
  59. .strokeJoin(ROUND)
  60. .strokeCap(ROUND)
  61. .strokeWeight(.5)
  62. .rotate( (int)random(360) )
  63. .size( (int)random(10,30) )
  64. .loc( (int)random(width), (int)random(height) )
  65. .anchorAt(H.CENTER)
  66. ;
  67. b.randomColors(colors.fillOnly());
  68. H.add(b);
  69. }
  70.  
  71.  
  72. for (int i = 0; i < 5; ++i) {
  73. c = new HShape("cgrid.svg");
  74. c
  75. .enableStyle(false)
  76. // .noStroke()
  77. .strokeJoin(ROUND)
  78. .strokeCap(ROUND)
  79. .strokeWeight(.5)
  80. .rotate( (int)random(360) )
  81. .size( (int)random(20,50) )
  82. .loc( (int)random(width), (int)random(height) )
  83. .anchorAt(H.CENTER)
  84. ;
  85. c.randomColors(colors.fillOnly());
  86. H.add(c);
  87. }
  88.  
  89.  
  90. for (int i = 0; i < 40; ++i) {
  91. d = new HShape("circle.svg");
  92. d
  93. .enableStyle(false)
  94. // .noStroke()
  95. .strokeJoin(ROUND)
  96. .strokeCap(ROUND)
  97. .strokeWeight(.5)
  98. .rotate( (int)random(360) )
  99. .size( (int)random(10,320) )
  100. .loc( (int)random(width), (int)random(height) )
  101. .anchorAt(H.CENTER)
  102. ;
  103. d.randomColors(colors.fillOnly());
  104. H.add(d);
  105. }
  106.  
  107.  
  108. for (int i = 0; i < 5; ++i) {
  109. e = new HShape("dots.svg");
  110. e
  111. .enableStyle(false)
  112. // .noStroke()
  113. .strokeJoin(ROUND)
  114. .strokeCap(ROUND)
  115. .strokeWeight(.5)
  116. .rotate( (int)random(360) )
  117. .size( (int)random(40,60) )
  118. .loc( (int)random(width), (int)random(height) )
  119. .anchorAt(H.CENTER)
  120. ;
  121. e.randomColors(colors.fillOnly());
  122. H.add(e);
  123. }
  124.  
  125.  
  126. for (int i = 0; i < 10; ++i) {
  127. f = new HShape("heart.svg");
  128. f
  129. .enableStyle(false)
  130. // .noStroke()
  131. .strokeJoin(ROUND)
  132. .strokeCap(ROUND)
  133. .strokeWeight(.5)
  134. .rotate( (int)random(360) )
  135. .size( (int)random(30,70) )
  136. .loc( (int)random(width), (int)random(height) )
  137. .anchorAt(H.CENTER)
  138. ;
  139. f.randomColors(colors.fillOnly());
  140. H.add(f);
  141. }
  142.  
  143.  
  144. for (int i = 0; i < 5; ++i) {
  145. g = new HShape("lessthan.svg");
  146. g
  147. .enableStyle(false)
  148. // .noStroke()
  149. .strokeJoin(ROUND)
  150. .strokeCap(ROUND)
  151. .strokeWeight(.5)
  152. .rotate( (int)random(360) )
  153. .size( (int)random(10,30) )
  154. .loc( (int)random(width), (int)random(height) )
  155. .anchorAt(H.CENTER)
  156. ;
  157. g.randomColors(colors.fillOnly());
  158. H.add(g);
  159. }
  160.  
  161.  
  162. for (int i = 0; i < 5; ++i) {
  163. h = new HShape("line1.svg");
  164. h
  165. .enableStyle(false)
  166. // .noStroke()
  167. .strokeJoin(ROUND)
  168. .strokeCap(ROUND)
  169. .strokeWeight(.5)
  170. .rotate( (int)random(360) )
  171. .size( (int)random(100,250) )
  172. .loc( (int)random(width), (int)random(height) )
  173. .anchorAt(H.CENTER)
  174. ;
  175. h.randomColors(colors.fillOnly());
  176. H.add(h);
  177. }
  178.  
  179.  
  180. for (int i = 0; i < 10; ++i) {
  181. r = new HShape("line2.svg");
  182. r
  183. .enableStyle(false)
  184. // .noStroke()
  185. .strokeJoin(ROUND)
  186. .strokeCap(ROUND)
  187. .strokeWeight(.5)
  188. .rotate( (int)random(360) )
  189. .size( (int)random(100,250) )
  190. .loc( (int)random(width), (int)random(height) )
  191. .anchorAt(H.CENTER)
  192. ;
  193. r.randomColors(colors.fillOnly());
  194. H.add(r);
  195. }
  196.  
  197.  
  198. for (int i = 0; i < 5; ++i) {
  199. j = new HShape("one.svg");
  200. j
  201. .enableStyle(false)
  202. // .noStroke()
  203. .strokeJoin(ROUND)
  204. .strokeCap(ROUND)
  205. .strokeWeight(.5)
  206. .rotate( (int)random(360) )
  207. .size( (int)random(100,250) )
  208. .loc( (int)random(width), (int)random(height) )
  209. .anchorAt(H.CENTER)
  210. ;
  211. j.randomColors(colors.fillOnly());
  212. H.add(j);
  213. }
  214.  
  215.  
  216. for (int i = 0; i < 5; ++i) {
  217. k = new HShape("two.svg");
  218. k
  219. .enableStyle(false)
  220. // .noStroke()
  221. .strokeJoin(ROUND)
  222. .strokeCap(ROUND)
  223. .strokeWeight(.5)
  224. .rotate( (int)random(360) )
  225. .size( (int)random(20,45) )
  226. .loc( (int)random(width), (int)random(height) )
  227. .anchorAt(H.CENTER)
  228. ;
  229. k.randomColors(colors.fillOnly());
  230. H.add(k);
  231. }
  232.  
  233.  
  234. for (int i = 0; i < 60; ++i) {
  235. q = new HShape("pill.svg");
  236. q
  237. .enableStyle(false)
  238. // .noStroke()
  239. .strokeJoin(ROUND)
  240. .strokeCap(ROUND)
  241. .strokeWeight(.5)
  242. .rotate( (int)random(360) )
  243. .size( (int)random(5,15) )
  244. .loc( (int)random(width), (int)random(height) )
  245. .anchorAt(H.CENTER)
  246. ;
  247. q.randomColors(colors.fillOnly());
  248. H.add(q);
  249. }
  250.  
  251.  
  252. for (int i = 0; i < 5; ++i) {
  253. l = new HShape("pills.svg");
  254. l
  255. .enableStyle(false)
  256. // .noStroke()
  257. .strokeJoin(ROUND)
  258. .strokeCap(ROUND)
  259. .strokeWeight(.5)
  260. .rotate( (int)random(360) )
  261. .size( (int)random(50,150) )
  262. .loc( (int)random(width), (int)random(height) )
  263. .anchorAt(H.CENTER)
  264. ;
  265. l.randomColors(colors.fillOnly());
  266. H.add(l);
  267. }
  268.  
  269.  
  270. for (int i = 0; i < 10; ++i) {
  271. m = new HShape("smiley.svg");
  272. m
  273. .enableStyle(false)
  274. // .noStroke()
  275. .strokeJoin(ROUND)
  276. .strokeCap(ROUND)
  277. .strokeWeight(.5)
  278. .rotate( (int)random(360) )
  279. .size( (int)random(50,200) )
  280. .loc( (int)random(width), (int)random(height) )
  281. .anchorAt(H.CENTER)
  282. ;
  283. m.randomColors(colors.fillOnly());
  284. H.add(m);
  285. }
  286.  
  287.  
  288. for (int i = 0; i < 5; ++i) {
  289. n = new HShape("smiley2.svg");
  290. n
  291. .enableStyle(false)
  292. // .noStroke()
  293. .strokeJoin(ROUND)
  294. .strokeCap(ROUND)
  295. .strokeWeight(.5)
  296. .rotate( (int)random(360) )
  297. .size( (int)random(30,60) )
  298. .loc( (int)random(width), (int)random(height) )
  299. .anchorAt(H.CENTER)
  300. ;
  301. n.randomColors(colors.fillOnly());
  302. H.add(n);
  303. }
  304.  
  305.  
  306. for (int i = 0; i < 60; ++i) {
  307. o = new HShape("square.svg");
  308. o
  309. .enableStyle(false)
  310. // .noStroke()
  311. .strokeJoin(ROUND)
  312. .strokeCap(ROUND)
  313. .strokeWeight(.5)
  314. .rotate( (int)random(360) )
  315. .size( (int)random(5,15) )
  316. .loc( (int)random(width), (int)random(height) )
  317. .anchorAt(H.CENTER)
  318. ;
  319. o.randomColors(colors.fillOnly());
  320. H.add(o);
  321. }
  322.  
  323.  
  324. for (int i = 0; i < 50; ++i) {
  325. p = new HShape("triangle.svg");
  326. p
  327. .enableStyle(false)
  328. // .noStroke()
  329. .strokeJoin(ROUND)
  330. .strokeCap(ROUND)
  331. .strokeWeight(.5)
  332. .rotate( (int)random(360) )
  333. .size( (int)random(5,15) )
  334. .loc( (int)random(width), (int)random(height) )
  335. .anchorAt(H.CENTER)
  336. ;
  337. p.randomColors(colors.fillOnly());
  338. H.add(p);
  339. }
  340.  
  341. noLoop();
  342. saveVector();
  343. H.drawStage();
  344. }
  345.  
  346. void draw() {
  347. H.drawStage();
  348. }
  349.  
  350. void saveVector() {
  351. PGraphics tmp = null;
  352. tmp = beginRecord(PDF, "render_05.pdf");
  353.  
  354. if (tmp == null) {
  355. H.drawStage();
  356. } else {
  357. H.stage().paintAll(tmp, false, 1); // PGraphics, uses3D, alpha
  358. }
  359.  
  360. endRecord();
  361. }
Add Comment
Please, Sign In to add comment