Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Created June 18, 2018 20:11
Show Gist options
  • Select an option

  • Save mimetaur/28ffc1f8f48438362b15db922f95ea20 to your computer and use it in GitHub Desktop.

Select an option

Save mimetaur/28ffc1f8f48438362b15db922f95ea20 to your computer and use it in GitHub Desktop.
contents of week 02 / sketch 07 / attributewrangle1
int seed = set(ch("seed"));
float strength = ch("strength");
// trying out smoothing between two random values
float smoothedRand = smooth(random(seed + @pointnum),random(seed + @pointnum+1), 0.5);
// moving random from 0 to 1 to -0.5 to 0.5
float equalized = 0.5 -smoothedRand;
// y pos displaced based to rand * strength param
float randomDisplace = smoothedRand * strength;
@P.y += randomDisplace;
// using the same rand value to scale the particles
@pscale = fit(smoothedRand, 0, 1, 0, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment