Created
February 21, 2012 18:20
-
-
Save mrdoob/1877952 to your computer and use it in GitHub Desktop.
Single Lane Superhighway - Landscape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var svg = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' ); | |
svg.setAttribute( 'width', 1000 ); | |
svg.setAttribute( 'height', 200 ); | |
document.body.appendChild( svg ); | |
var path = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); | |
path.setAttribute( 'style', 'stroke: black; stroke-width: 1px; fill: none;' ); | |
svg.appendChild( path ); | |
var drawing = 'M 0 ' + ( Math.cos( position ) * 50 + 100 ) + ' '; | |
for ( var i = 0, l = 1000; i <= l; i += 20 ) { | |
drawing += 'L' + i + ' ' + ( Math.cos( ( i / 2000 ) * 10 ) * 50 + 100 ) + ' '; | |
} | |
path.setAttribute( 'd', drawing ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment