How to use the pyp5js.P5.mouseX function in pyp5js

To help you get started, we’ve selected a few pyp5js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berinhard / sketches / s_097 / target / sketch.py View on Github external
def draw():
    global t
    width = P5.width
    height = P5.height

    P5.background(10, 10)

    xAngle = P5.map(P5.mouseX, 0, P5.width, -4 * P5.PI, 4 * P5.PI, True)
    yAngle = P5.map(P5.mouseY, 0, P5.height, -4 * P5.PI, 4 * P5.PI, True)
    for x in range(0, width, 30):
        for y in range(0, height, 30):

            angle = xAngle * (x / width) + yAngle * (y / height)

            myX = x + 20 * P5.cos(2 * P5.PI * t + angle)
            myY = y + 20 * P5.sin(2 * P5.PI * t + angle)

            P5.ellipse(myX, myY, 10)

    t = t + 0.01

    console.log(P5.frameRate())

pyp5js

Simple tool to allow to transcrypt Python code that uses P5.js

LGPL-3.0
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages