Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. float cX,cY;
  2. float scale,rotate;
  3. int offsetX,offsetY;
  4. int divisions = 6;
  5. float R;
  6. void setup(){
  7. size( 640, 1000 );
  8. strokeWeight( 3 );
  9. frameRate( 2 );
  10. }
  11.  
  12. void GlyphRadial(int index,int divisor, int offsetX, int offsetY) {
  13. //Center to Point on Circle
  14. line(cX+offsetX,cY+offsetY,(scale*cos((index*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin((index*(TAU/divisor))+rotate)+cY+offsetY));
  15. }
  16.  
  17. void GlyphSegment(int index,int divisor, int offsetX, int offsetY) {
  18. //Point on Circle to Next Point on Circle
  19. line((scale*cos((index*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin((index*(TAU/divisor))+rotate)+cY+offsetY),
  20. (scale*cos(((index+1)*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin(((index+1)*(TAU/divisor))+rotate)+cY+offsetY));
  21. }
  22.  
  23. void Glyph(int offsetX, int offsetY) {
  24. IntList GlyphLine;
  25. GlyphLine = new IntList();
  26.  
  27. for(int a=0;a<(divisions*2);a++) {
  28. GlyphLine.append(a);
  29. }
  30.  
  31. GlyphLine.shuffle();
  32.  
  33.  
  34.  
  35.  
  36.  
  37. for(int b=0;b<3;b++) {
  38. if(GlyphLine.get(b) <= divisions) {
  39. GlyphRadial(GlyphLine.get(b),divisions,offsetX,offsetY);
  40. } else {
  41. GlyphSegment((GlyphLine.get(b)-divisions),divisions,offsetX,offsetY);
  42. }
  43. }
  44. }
  45.  
  46. void draw(){
  47. background(20);
  48. stroke(0,255,0);
  49. int spacing = 25;
  50. R=0;
  51. cX=40;
  52. cY=40;
  53. scale=9.0;
  54. rotate=R;
  55. for(int y = 20;y<940;y=y+spacing) {
  56. for(int x = 10;x<560;x=x+spacing) {
  57. //rotate=.05*PI+R;
  58. //R=R+.1;
  59. Glyph(x,y);
  60. }}
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement