Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Last active June 19, 2018 23:06
Show Gist options
  • Select an option

  • Save mimetaur/302ac90651fefddba0c546d782bcf39d to your computer and use it in GitHub Desktop.

Select an option

Save mimetaur/302ac90651fefddba0c546d782bcf39d to your computer and use it in GitHub Desktop.
Sketch 4 / Animate Points Attribute wrangle
float amplitude = ch("amp");
float amp_scale = ch("amp_scale");
float noise_freq = ch("noise_freq");
float noise_offset = ch("noise_offset");
float time_speed = ch("time_speed");
for(float n = 0; n < 1; n += @increment)
{
float base_noise_x = noise_offset + (noise_freq * @ptnum);
float base_noise_y = noise_offset + (noise_freq * @ptnum);
float timescale_x = @Time * time_speed;
float timescale_y = @Time * time_speed;
float noise_over_time_x = noise(base_noise_x + timescale_x);
float noise_over_time_y = noise(base_noise_x + timescale_y);
float offset_x = fit(noise_over_time_x, 0, 1, -0.5, 0.5) * amplitude * amp_scale;
float offset_y = fit(noise_over_time_y, 0, 1, -0.5, 0.5) * amplitude * amp_scale;
@P.x += offset_x;
@P.z += offset_y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment