diff --git a/examples/Animation/Animation.pde b/examples/Animation/Animation.pde new file mode 100644 index 0000000..5216b45 --- /dev/null +++ b/examples/Animation/Animation.pde @@ -0,0 +1,33 @@ +/************************************************************ +* PeasyGradients example +* +* Basic white to black gradient rendered to the main PApplet +*************************************************************/ + +// Necessary imports +import micycle.peasygradients.*; +import micycle.peasygradients.utilities.*; +import micycle.peasygradients.gradient.*; + +// Gradient context to be bound to a renderer +PeasyGradients peasyGradients; +// Basic black to white Gradient +Gradient blackToWhite = new Gradient(color(0), color(255)); + + +void setup() { + size(400, 400); + + // Binding the gradient context to the current PApplet + peasyGradients = new PeasyGradients(this); + + // Remove seam from start and end of gradient + blackToWhite.primeAnimation(); +} + +void draw() { + // Animate/ move the gradient + blackToWhite.animate(0.01f); + // Render gradient to context + peasyGradients.linearGradient(blackToWhite, 0); // angle = 0 (horizontal) +} diff --git a/examples/BasicBlackWhite/BasicBlackWhite.pde b/examples/BasicBlackWhite/BasicBlackWhite.pde new file mode 100644 index 0000000..4a5ce58 --- /dev/null +++ b/examples/BasicBlackWhite/BasicBlackWhite.pde @@ -0,0 +1,25 @@ +/************************************************************ +* PeasyGradients example +* +* Basic white to black gradient rendered to the main PApplet +*************************************************************/ + +// Necessary imports +import micycle.peasygradients.*; +import micycle.peasygradients.gradient.*; + +// Gradient context to be bound to a renderer +PeasyGradients peasyGradients; +// Basic black to white Gradient +Gradient blackToWhite = new Gradient(color(0), color(255)); + +void setup() { + size(400, 400); + + // Binding the gradient context to the current PApplet + peasyGradients = new PeasyGradients(this); +} + +void draw() { + peasyGradients.linearGradient(blackToWhite, 0); // angle = 0 (horizontal) +} diff --git a/examples/Radial/Radial.pde b/examples/Radial/Radial.pde new file mode 100644 index 0000000..78231ff --- /dev/null +++ b/examples/Radial/Radial.pde @@ -0,0 +1,33 @@ +/************************************************************ +* PeasyGradients example +* +* Basic white to black gradient rendered to the main PApplet +*************************************************************/ + +// Necessary imports +import micycle.peasygradients.*; +import micycle.peasygradients.utilities.*; +import micycle.peasygradients.gradient.*; + +// Gradient context to be bound to a renderer +PeasyGradients peasyGradients; +// Basic black to white Gradient +Gradient blackToWhite = new Gradient(color(0), color(255)); + + +void setup() { + size(400, 400); + + // Binding the gradient context to the current PApplet + peasyGradients = new PeasyGradients(this); + + // Remove seam from start and end of gradient + blackToWhite.primeAnimation(); +} + +void draw() { + // Animate/ move the gradient + blackToWhite.animate(-0.01f); + // Render gradient to context + peasyGradients.radialGradient(blackToWhite, new PVector(mouseX, mouseY), 1); // angle = 0 (horizontal) +}