Skip to content

Commit

Permalink
Add time example
Browse files Browse the repository at this point in the history
  • Loading branch information
PollRobots committed Jul 11, 2024
1 parent 4d9f4f0 commit 636a1b0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 636a1b0

Please # to comment.