Trasformazioni cromatiche con tint()
// height=300 lines=auto
let bitmap;
function preload() {
bitmap = loadImage("assets/eyes_bn.jpg");
}
function setup() {
createCanvas(670,300);
}
function draw() {
background( 0, 4 );
shearX( sin(frameCount/40) / 6 );
blendMode( LIGHTEST );
image( bitmap, 0,0 );
blendMode( BLEND );
filter( DILATE );
let img = get( random(width),random(height),
random(1,width),random(1,height) );
// QUANTITÀ COMPONENTI CROMATICHE ///////////////////////////
tint( 255, 128, 0 );
image( img, random(width),random(height) );
noTint();
}
tint( 255, 128, 0 );
Preimposta le percentuali di colore da mantenere quando verranno usate le istruzioni che trasferiscono pixel sul canvas, come image(). Nel caso specifico, verrà mantenuto il 100% del rosso (255/255), il 50% del verde (128/255) e lo 0% del blu (0/255).
noTint();
Disattiva le impostazioni dell'ultima istruzione tint().
Per capire meglio come funzionano i parametri dell'istruzione tint() si può provare a modificarli direttamente con i tasti freccia nello sketch Effetto tinta interattivo.
Strutturazione dei file:
- CARTELLA-SKETCH
- assets
- libs
- p5.min.js
- index.html
- sketch.js