Skip to content

Instantly share code, notes, and snippets.

@emmettbutler
Created May 14, 2013 19:33
Show Gist options
  • Save emmettbutler/5578779 to your computer and use it in GitHub Desktop.
Save emmettbutler/5578779 to your computer and use it in GitHub Desktop.
static int iter = 0;
for(int j = 0; j < 6; j++){
for(int i = 0; i < texture->getContentSize().width; i++){
float width = 127;
float red = sin(.05*i*PerlinNoise::noise(i*.005+iter*.005*j, i*.01) + 0) * width + 128;
float grn = sin(.05*i*PerlinNoise::noise(i*.005+iter*.005*j, i*.01) + 2) * width + 128;
float blu = sin(.05*i*PerlinNoise::noise(i*.005+iter*.005*j, i*.01) + 4) * width + 128;
ccColor4B color = ccc4(red, grn, blu, 255);
texture->setPixelAt(CCPoint(i+.03*(texture->getContentSize().width-i)*PerlinNoise::noise((i+iter)*.03, 10*j),
lineHeight+(j*(texture->getContentSize().height/6))+((texture->getContentSize().width-i)*.4)*
PerlinNoise::noise((i*.7+iter)*.03, 10*j)),
color);
}
}
iter++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment