p5py / p5-examples Goto Github PK
View Code? Open in Web Editor NEWp5 example code
License: MIT License
p5 example code
License: MIT License
When I try to run one of the programs it states that it can't find the to import module p5. Could anyone clarify what I'm doing wrong?
This is not an issue :-)
Perhaps could you put this snippet in examples directory ?
Feel free to modify it as you like
Regards
# Drawing Arrows
from p5 import *
ang = PI/60.0
v = Vector(0, 100)
def setup():
size(800, 600)
title("Rotating Arrow")
def line_vect(v1, v2):
line((v1.x, v1.y), (v2.x , v2.y))
def drawArrow(v1, v2):
vs = v2 - v1
mag, angle = vs.magnitude, vs.angle
line_vect(v1, v2)
with push_matrix():
rotate(angle)
line((mag, 0), (mag - 15, 6))
line((mag, 0), (mag - 15, -6))
def drawAxes():
drawArrow(Vector(0,0), Vector(0, -250))
drawArrow(Vector(0,0), Vector(250, 0))
def draw():
background(0, 0, 0, 5.0)
stroke(0, 223, 0)
translate(width/2, height/2)
drawAxes()
stroke(255, 0, 0)
drawArrow(Vector(0, 0), v)
v.rotate(ang)
if __name__ == '__main__':
run()
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.