-
-
Save Ameliawb/2bcb20f2ff119edaa315 to your computer and use it in GitHub Desktop.
My attempt to make a sketch into p5.js from processing.
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
<html> | |
<head> | |
<title>VelocityCODE</title> | |
<script language="javascript" type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.2.1/p5.min.js"></script> | |
<script language="javascript" type="text/javascript" src="sketch1.5.js"> | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> | |
//Based on example code from ‘movement’ section in processing book | |
//modified by Amelia Winger-Bearskin Processing 2.1.1. i made this for MATH class originally in processing | |
//and this is my attempt to put it into p5.js which is failed miserably.... | |
var inc = 0.0; | |
var b; | |
var c; | |
var x = 1; | |
var wave; | |
function setup() { | |
createCanvas(1200, 700); | |
c + = 15; | |
stroke(c * 5, c + 100, 200 - c * 3, 6); | |
smooth(); | |
} | |
function draw() { | |
background(0); | |
inc + = 0.01; | |
angle = sin(inc) / 50.0 + sin(inc * 1.2) / 20.0; | |
b + = 1; | |
wave(); | |
//wave(b + 1, height / 2, angle / 1.3); | |
//wave(b + 2, height / 2, angle); | |
//wave(b + 3, height / 3, angle / 1.3); | |
//wave(b + 5, height / 4, angle); | |
//wave(b + 4, height / 5, angle * 2); | |
//wave(b - 5, height / 4, angle * 4); | |
//wave(b - 4, height / b, angle + angle); | |
} | |
function wave() { | |
pushMatrix(); | |
translate(x, 100); | |
for (var i = units; i > 0; i–) { | |
strokeWeight(i); | |
line(40, 10, 0, -8); | |
translate(4, -8); | |
rotate(angle / 2); | |
} | |
popMatrix(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment