In a yet dilapidated and uneventful life, where a glimmer of hope persistently lies in my making through the final year of a much twisted Computer Science Engineering. I welcome you to my page much inspired from blossoming hashtag of #100daysofcreativecoding (since time management is a much awaited battle) and abundance of caffeine in my veins. Though I've strived to make any compelling sketches as of now, I again like several 'newbies' floating is a perpetual existence of forums glistening the pages with psychedelic patterns, I would love to present a better looking sketch.
Ostensible it may seem, I'd like to call it . 'The Colour-blind smokescreen'.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| ArrayList<PVector>allVectors;float wanderSpeed = 3.6;int numSteps = 14;float lineHue = 2.0;float lineSat = 0.0;float lineBright = 1.5;float colorTrigger = 0.982;boolean autoplay = true;void setup(){ size(1600, 900); colorMode(HSB, 1.0, 1.0, 1.0, 1.0); background(0.0); noFill(); createLine(); randomizeColor();}void draw(){ strokeWeight(1.01); //randomize color if (random (0, 1)>colorTrigger)randomizeColor(); stroke(lineHue, lineSat, lineBright, 0.09); fill(255); //draw bottom line beginShape(); for (int i = 0; i <allVectors.size (); i++) { PVector vector = allVectors.get(i); if (i == 0) curveVertex(vector.x, vector.y); curveVertex(vector.x, vector.y); if (i == allVectors.size()-1) curveVertex(vector.x,vector.y); vector.x +=random(-wanderSpeed, wanderSpeed); vector.y +=random(-wanderSpeed, wanderSpeed); vector.y -=0.1; if (i == 0) vector.x = 0; if (i == allVectors.size()-1) vector.x = width; } endShape(); checkAutoplay();}void checkAutoplay(){ if (autoplay) { // reset if line has left screen for (int i = 0; i<allVectors.size (); i++) { PVector vector = allVectors.get(i); if (vector.y < height) return; } // reset if boundary check didn't exit functiion reset(); }}void createLine(){ allVectors = new ArrayList<PVector>(); for (int i=0; i<=numSteps; i++) { PVector vector = new PVector(i * width/numSteps, height/2); allVectors.add(vector); }}void randomizeColor(){ lineHue = random(0, 1); lineSat = random(0, 1); lineBright = random(0,1);}void reset(){ background(0.0); createLine(); randomizeColor(); wanderSpeed = random(0.3, 2.0); numSteps = (int)random(1, 20); colorTrigger = random(0.99, 0.9999);} |
No comments:
Post a Comment