YujiSODE / landformPath

Methods that generates imaginary landform contour paths

Home Page:https://yujisode.github.io/landformPath/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code samples

YujiSODE opened this issue · comments

Code samples

Sample to generate imaginary landforms

/*========================
* sample script using "landformPath.js" and "landformPath_tools.js"
*  C is a canvas element
* canvas size: 300x300
*========================
*/
var R=[],i=0,L=getLandform(C);
//1st path
while(i<20){R.push(20*Math.random()),i+=1;}
L.curves(70,70,R,10,5);
//2nd path
R=[],i=0;
while(i<30){R.push(10*Math.random()),i+=1;}
L.lines(180,120,R,11,5,1);
//3rd path
R=[],i=0;
while(i<20){R.push(30*Math.random()),i+=1;}
L.curves(80,190,R,7,5,2);
//4th path
R=[],i=0;
while(i<40){R.push(25*Math.random()),i+=1;}
L.coveringCurves(R,10,5);

ss20180817
Figure 1. Result on canvas.

Sample to generate imaginary landforms

v0.1.1

/*========================
* sample script using "landformPath.js" and "landformPath_tools.js"
* canvas size: 500x500
*========================
*/
var C=document.getElementsByTagName('canvas')[0],R=[],i=0,L=getLandform(C);
C.getContext('2d').clearRect(0,0,C.width,C.height);
//1st path
while(i<20){R.push(20*Math.random()),i+=1;}
L.curves(50,30,R,10,5);
//2nd path
R=[],i=0;
while(i<30){R.push(25*Math.random()),i+=1;}
L.lines(250,160,R,11,5,1);
//3rd path
R=[],i=0;
while(i<20){R.push(30*Math.random()),i+=1;}
L.curves(50,220,R,7,5,2);
//4th path
R=[],i=0;
while(i<70){R.push(45*Math.random()),i+=1;}
L.coveringCurves(R,10,5);

sample20180824
Figure 1. Result on canvas.