shiffman / learningprocessing-p5.js Goto Github PK
View Code? Open in Web Editor NEWPort all of Learning Processing examples to JavaScript using p5.js
Home Page: http://learningprocessing.com
Port all of Learning Processing examples to JavaScript using p5.js
Home Page: http://learningprocessing.com
The data folder is missing for chp15_images_pixels's example.
Are you happy to receive pull requests for such small modifications or would you prefer these submitted as issues?
Here's a basic model of how I'm doing this simply:
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Exercise 8-5: Rewrite the gravity example from Chapter 5 using objects with a Ball class.
// Include two instances of a Ball object.
// Ball constuctor
class Ball {
constructor(x, y, w) {
this.x = x; // x location of square
this.y = y; // y location of square
this.w = w; // speed of square
this.speed = 0; // size
}
display() {
// Display the square
fill(175);
stroke(0);
ellipse(this.x, this.y, this.w, this.w);
}
update() {
// Add speed to location
this.y = this.y + this.speed;
// Add gravity to speed
this.speed = this.speed + gravity;
// If square reaches the bottom
// Reverse speed
if (this.y > height) {
this.speed = this.speed * -0.95;
}
}
}
When I click the program to run in the folder nothing happens....I downloaded the Linus 64bit.
On line 22 here should read console.log() not println()
EDIT: Ahh, I guess println() and print() are still a thing in p5. Is this something we want though? Shouldn't we be teaching console.log() only?
skipping 19 and 21 due to JS compatibility. After the above is complete need to bring everything into https://github.com/shiffman/LearningProcessing.com
http://learningprocessing.com/examples/chp08/example-08-02-twoobjects
My browser is:
Version 87.0.4280.88 (Official Build) (arm64)
From reading the source I was expecting to see two cars in different shades of grey with different speeds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.