Giter Club home page Giter Club logo

the-nature-of-code's Introduction

Lessons - The Nature of Code

In this repository you will find code, examples and experiments based on the youtube playlist The Nature of Code 2. The goal is to better understand the P5.js library as well as practice JavaScript applied to creative coding.

I.2: Introduction - Perlin Noise and p5.js Tutorial

Video

  • Function random() and function noise() have different outcomes;
  • Function random():
    • Generates random numbers that are not related with one another;
  • Funcion noise():
    • Is a Perlin Noise function, named after Perlin, who has developed code for procedural texturing in computer graphics in the 80's;
    • Generates smooth random numbers that are related with one another;
    • The algorith define waveforms based on random values and sum these waveforms to create a final shape;
    • Each waveform is an octave apart from the other (random numbers taken with double frequency);

I.3: noise() vs random() - Perlin Noise and p5.js Tutorial

Video

  • Application of perlin noise;

  • Experiments with perlin noise:

      var xoff = 0;
      var yoff = 0;
      var doff = 0;
    
      function setup() {
        createCanvas(innerWidth,innerHeight);
        noiseSeed(100);
      }
    
      function draw() {
        ellipse(
          map(noise(xoff), 0, 1, 0, width),
          map(noise(yoff),0,1,0,height),
          map(noise(doff),0,1,20,50),
          map(noise(doff),0,1,20,50)
        );
        xoff += 0.007;
        yoff += 0.009;
        doff += 0.011;
      }
    • The values xoff, yoff and doff represent how much does the algorithm moves in perlin noise space at each iteration;
    • The bigger the xoff value, the more close from random() the values get, but with one difference: perlin noise tend to look like a gaussian distribution;

the-nature-of-code's People

Contributors

amaralc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.