Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* LERP example (c) 2015 Giles Cartmel */
- int squares = 25; // well, rectangles anyway
- void setup() {
- size(900,600); // choose any screen size
- background(0);
- stroke(255);
- noLoop(); // just draw once
- }
- void draw() {
- // split the x size (width) into the defined equal squares
- for (int x = 0; x <= squares; x++) {
- line(lerp(0,width-1,(float) x/squares)
- ,0
- ,lerp(0,width-1,(float) x/squares)
- ,height-1
- );
- }
- // split the y size (height) into the defined equal squares
- for (int y = 0; y <= squares; y++) {
- line(0
- ,lerp(0,height-1,(float) y/squares)
- ,width-1
- ,lerp(0,height-1,(float) y/squares)
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement