Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float cX,cY;
- float scale,rotate;
- int offsetX,offsetY;
- int divisions = 6;
- float R;
- void setup(){
- size( 640, 1000 );
- strokeWeight( 3 );
- frameRate( 2 );
- }
- void GlyphRadial(int index,int divisor, int offsetX, int offsetY) {
- //Center to Point on Circle
- line(cX+offsetX,cY+offsetY,(scale*cos((index*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin((index*(TAU/divisor))+rotate)+cY+offsetY));
- }
- void GlyphSegment(int index,int divisor, int offsetX, int offsetY) {
- //Point on Circle to Next Point on Circle
- line((scale*cos((index*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin((index*(TAU/divisor))+rotate)+cY+offsetY),
- (scale*cos(((index+1)*(TAU/divisor))+rotate))+cX+offsetX,(scale*sin(((index+1)*(TAU/divisor))+rotate)+cY+offsetY));
- }
- void Glyph(int offsetX, int offsetY) {
- IntList GlyphLine;
- GlyphLine = new IntList();
- for(int a=0;a<(divisions*2);a++) {
- GlyphLine.append(a);
- }
- GlyphLine.shuffle();
- for(int b=0;b<3;b++) {
- if(GlyphLine.get(b) <= divisions) {
- GlyphRadial(GlyphLine.get(b),divisions,offsetX,offsetY);
- } else {
- GlyphSegment((GlyphLine.get(b)-divisions),divisions,offsetX,offsetY);
- }
- }
- }
- void draw(){
- background(20);
- stroke(0,255,0);
- int spacing = 25;
- R=0;
- cX=40;
- cY=40;
- scale=9.0;
- rotate=R;
- for(int y = 20;y<940;y=y+spacing) {
- for(int x = 10;x<560;x=x+spacing) {
- //rotate=.05*PI+R;
- //R=R+.1;
- Glyph(x,y);
- }}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement