Stephen Meschke's practice log

All logs

Stephen Meschke's pages:
Profile
Practice calendar
Records
Charts
Full log

2016-02-19

Stephen Meschke

Juggling Simulator, 60 minutes

Animation created by the juggling simulator I wrote: https://youtu.be/yCAWA0LYjGg

import cv2
import numpy as np
import math
i = 0
h,w = 800, 800
scale = 300
colors = (0,0,255), (0,255,0), (255,0,0),(125,0,125), (0,125,125), (125,125,0), (125,125,125)
tracks = []
while True:
img = np.zeros((h,w,3),np.uint8)
phase = 0
for color in colors:
y = math.sin((i+phase)*2)*scale
x = math.cos(i+phase)*scale*.6
center = int(x)+w/2,int(y)+h/2
cv2.circle(img,center, 5, color, thickness=5)
phase+= math.pi/len(colors)*2
tracks.append(center)
for p in tracks[-800:]:
cv2.circle(img,p, 1, (129,192,192), thickness=1)
cv2.imshow('img', img)
cv2.waitKey(1)
i += .008

Total practice time: 60 minutes

Location: Linux

Comments (0)