Catmull-Rom, Casteljau and Kawano curves.

edited October 2013 in Share Your Work

Hi,

I have finished week 14 of Andrew Glassner’s 2D Animation and Interaction Course. This week was about creating, drawing and using free-form curves. Read more and (eventually you may) check the images/animations/code at:

http://mycodehistory.wordpress.com/

Comments

  • edited October 2013

    Nice experiments there. And I've made some performance tweaks to the 1st 1 there: :ar!
    http://www.loftmatic.com/_pages/Research/HiroshiKawano/W14_01_01/W14_01_01.html

    Found out that noSmooth() would really boost speed there! (~~)
    Take a look at the modded 1 online below:
    http://studio.processingtogether.com/sp/pad/export/ro.9W$jcepauodqW/latest

    // Declare the color constants.
    final static color RED = #FF2618, ORA = #E8901A, BLU = #292A84;
    final static color WHI = #E0D8C8, BLA = #141214;
    
    // Size of the squares.
    final static float DIM = 20;
    
    // One array for the fill colors.
    color[] fillColor = {} //...
    
    // One array for each axis. The -40 square is placed outside the screen.
    // Otherwise the squares will all behave the same at the same moment.
    short[] squareX = {} //...
    short[] squareY = {} //...
    
    void setup() {
      size(800, 800);
      frameRate(5);
      noSmooth();
      noFill();
      strokeWeight(20);
    }
    
    void draw() {
      background(0);
    
      int i = -1;
      while (++i != fillColor.length) {
        final float x = squareX[i], y = squareY[i];
        final float rnd = random(-100, 100);
    
        stroke(fillColor[i]);
        bezier(x, y, x, y, x, y, x - rnd, y - rnd);
      }
    }
    
Sign In or Register to comment.