varying colors processing
i've operative porting guess formula over unchanging java netbeans. distant well, many all works great, solely i non-grayscale colors.
i have book draws spin pattern, should change colors spin formed modulus check. book seems hang, however, i can't unequivocally explain why.
if anyone trust guess java, tell me where mistake is, i'd unequivocally adore know.
for effect peer-review, here's small program:
package spirals;
import processing.core.*;
public category sure extends papplet
{
boyant x, y;
int i = 1, dia = 1;
boyant angle = 0.0f, circuit = 0f;
boyant speed = 0.05f;
//color palette
int gray = 0x0444444;
int blue = 0x07cb5f7;
int pinkish = 0x0f77cb5;
int youthful = 0x0b5f77c;
open main(){}
open stationary vacant main( string[] args )
{
papplet.main( new string[] { "spirals.main" } );
}
open vacant setup()
{
background( gray );
size( 400, 400 );
nostroke();
smooth();
}
open vacant draw()
{
if( i % 11 == 0 )
fill( youthful );
else if( i % 13 == 0 )
fill( blue );
else if( i % 17 == 0 )
fill( pinkish );
else
fill( gray );
circuit += 0.1f; //ever rather boost orbit
angle += speed % ( extent * tallness );
boyant sinval = sin( angle );
boyant cosval = cos( angle );
//calculate (x, y) furnish an orbit
x = ( extent / 2 ) + ( cosval * circuit );
y = ( tallness / 2 ) + ( sinval * circuit );
dia %= 11; //keep hole within bounds.
ellipse( x, y, dia, dia );
dia++;
i++;
}
}
Comments
Post a Comment