All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.ripple.jfl Maven / Gradle / Ivy

/*
 * An example Jiffle script: creates concentric
 * ripples emanating from the image centre.
 *
 * Author: Michael Bedward
 */

/* We declare variables that we want to remain
 * in scope between pixels in the 'init' block.
 * The functions  width() and height() return
 * the dimensions of the destination area.
 */
init {
    xc = width() / 2;
    yc = height() / 2;
}

/* Calculations performed for each pixel.
 * The functions x() and y() return current
 * pixel coordinates.
 */
dx = (x()-xc)/xc;
dy = (y()-yc)/yc;
d = sqrt(dx^2 + dy^2);

/* The variable 'result' represents the
 * destination image (you can use any name
 * you like in your own scripts).
 */
result = sin(8 * M_PI * d);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy