Created
April 19, 2016 15:07
-
-
Save nick3499/c5b02ad1f557003dee1b94533fcb953f to your computer and use it in GitHub Desktop.
Dot Notation. Using p5.js library.
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 e = { x: 0, y: 360, d: 100 }; | |
var c1 = { r: 0, g: 255, b: 255 }; | |
var c2 = { r: 255, g: 255, b: 0 }; | |
function setup() { | |
createCanvas( 1280, 720 ); | |
} | |
function draw() { | |
// dot syntax | |
background( c1.r, c1.g, c1.b ); | |
fill( c2.r, c2.g, c2.b ); | |
noStroke(); | |
ellipse( e.x, e.y, e.d, e.d ); | |
// ellipse velocity algorithm | |
e.x = e.x + 0.125; | |
fill(0); | |
textSize(36); | |
text( 'dot notation accesses properties:', 25, 50 ); | |
text( 'background color, ellipse location/fill and velocity algorithm.', 25, 100 ); | |
text( 'background(c1.r, c1.g, c1.b);', 150, 150 ); | |
text( 'fill(c2.r, c2.g, c2.b);', 150, 200 ); | |
text( 'ellipse(e.x, e.y, e.d, e.d);', 150, 250 ); | |
text( 'e.x = e.x + 0.125;', 150, 300 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment