Sine in Creative Coding

In creative coding, sin and cos can be used for:

  • Draw a wave
  • Arrange items in circles and spirals
  • Generate smooth periodic motion
  • An ingredient of “fields”, that fill a line or space with a pattern that determines color, shape, or other qualities of drawing or motion that appears in that space.

Read

  • Getting Started with p5.js, “Circular’, pp. 162–172
  • 2bc9fe1d0b0d40ef9bbb86ef8a969e5c
    The Nature of Code

    "Trigonometry is a sine of the times." - Anonymous In Chapters 1 and 2, we carefully worked out an object-oriented structure to make something move on the screen, using the concept of a vector to represent location, velocity, and acceleration driven by forces in the environment.

    The Nature of Code
  • Course notes:
  • Arranging Items in a Circle or Spiral

Watch

3.1: Angles and Angular Motion - The Nature of Code

Chapter: 3Official book website: http://natureofcode.com/Twitter: https://twitter.com/shiffmanThis video describes how angles work in Processing and how you ...

3.1: Angles and Angular Motion - The Nature of Code
3.2: Trigonometry and Polar Coordinates - The Nature of Code

Chapter: 3Official book website: http://natureofcode.com/Twitter: https://twitter.com/shiffmanadded annotationsThis video describes the basics of trigonometr...

3.2: Trigonometry and Polar Coordinates - The Nature of Code
3.3: Simple Harmonic Motion - The Nature of Code

The Nature of Code (Chapter 3)http://natureofcode.com/Twitter: https://twitter.com/shiffmanThis video covers oscillating motion in Processing through the use...

3.3: Simple Harmonic Motion - The Nature of Code
3.6 Graphing Sine Wave - Nature of Code

What does a sine wave look like? In this video I look at how to graph and animate a sine wave in p5.js varying the period and phase. https://thecodingtrain.c...

3.6 Graphing Sine Wave - Nature of Code
Trigonometry - The graphs of sin and cos

Being able to visualize the trigonometric functions is important. This video will get you up to speed by showing you the basic graph for sine and cosine. Y...

Trigonometry - The graphs of sin and cos

Interact

sin() basics for Creative Coding

This is a sine wave. In p5, it is produced by plotting y = sin(x), where y loops from 0 to width. It's useful for drawing, for example, a wave shape: sin() can also be used to add periodic motion to an object: You can see the relationship between the motion (where sin() is a function of time), and the wave shape (where sin() is a function of $x$), by animating a trace of the shape position.

sin() basics for Creative Coding
Sine/Cosine: The Dome

Sine/Cosine: The Dome

Sine/Cosine: The Dome
Visualizing Sine and Cosine

Visualizing Sine and Cosine

Visualizing Sine and Cosine