Open
Description
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()