-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
added a bunch of vector examples #2812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm not sure why the new examples aren't passing the test. They all seem to work fine when I run This is the error message I get when I run grunt (one for each new example):
Appreciate any help. |
hm I'd need to dig a little deeper to figure out why they're failing.. but the reference examples are meant to be really short, concise snippets of code that don't require much programming knowledge or knowledge of other p5 functions to follow. I think the drawArrow() example might fit better on the examples page. there are instructions for adding examples here: https://github.com/processing/p5.js-website/wiki/Adding-examples |
Ah ok, I interpreted the examples page as being a place for slightly more creative applications. My goal was to provide a bit more visual intuition for each vector function. They're mostly basic uses of each function, except maybe dot() and cross()... the main reason they're long is because I added the (same) drawArrow() function to every example. I could replace that with a line if need be. |
src/math/p5.Vector.js
Outdated
@@ -441,6 +703,70 @@ p5.Vector.prototype.magSq = function magSq() { | |||
* print(p5.Vector.dot(v1, v2)); // Prints "10" | |||
* </code> | |||
* </div> | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels like one for the examples page rather than the reference
src/math/p5.Vector.js
Outdated
@@ -483,6 +809,51 @@ p5.Vector.prototype.dot = function dot(x, y, z) { | |||
* print(crossProduct); | |||
* </code> | |||
* </div> | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one might be better suited for the examples page too
ah I see ok. I thought that the functions you were demonstrating appeared in the drawArrow() function, which would require the user to parse through that function. but looking closer I see that they are used outside of the drawArrow() function, so this seems fine. I marked two that seem rather complex and might be better suited for the examples page, let me know what you think. the rest I agree are good to stay. |
also try pulling the latest changes and see if the code builds and tests pass this time. @Spongman just added a fix for one common error we were seeing in this process. |
I think it might be nice to move the |
Thanks @lmccart @Spongman for your feedback! I agree with all the suggestions, so I removed the dot() and cross() examples, and moved up the push() statement in drawArrow() for all the examples. Once again, the examples are failing the tests with the same error I pasted above. As far as I can tell, all the examples work fine in the locally generated docs, and there are no errors introduced with them when I open /test/test-reference.html or /test/test.html. So I'm at a loss what is breaking the tests. |
ok, after a lot of digging I figured out the problem. It seems if I replace |
good catch! yes the library isn't ready for ES6 yet. it's weird that the linter didn't catch this. BTW the reason the test fail is that they're run in PhantomJS which uses an older version of webkit. |
aha. thanks @aatishb |
Hi, I added some visual interactive examples to the p5.vector documentation. cc #1954
I'm not sure if all of this will be useful, let me know if you have any feedback on this.