From 636a1b048208d0e4b19c9bb815483e22da8f0a10 Mon Sep 17 00:00:00 2001 From: Paul C Roberts Date: Thu, 11 Jul 2024 16:16:17 -0700 Subject: [PATCH] Add time example --- docs/examples.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/examples.md b/docs/examples.md index 49072be..87aaa39 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -67,6 +67,26 @@ end-interactive-values|# (sphere #<:off 1 0> 1))) ``` +### Using Time + +```example +#|start-interactive-values + view.z = 0.7 +end-interactive-values|# + +(define noise (x) (+ (perlin x 1) (perlin x 2) (perlin x 4) (perlin x 8))) + +(color (saturate-xyz (lch-xyz (vec 50 75 (* 180 (noise (+ :pos :time)))))) + (sphere #<0 1 0> 1)) +``` + +This uses the current time to change the position used when generating +perlin noise. The result is then used to set the hue in the LCH colorspace, +which is then converted to XYZ and used as the color of a sphere. + +If you use the **edit** button to insert the example into the editor, you will +see the colors changing hue over the sphere in the classic perlin noise pattern. + ## Building a more complex model ### Starting small