kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
89ead6b260
commit
9722a67d86
|
|
@ -10,8 +10,8 @@
|
|||
<style> body, html, canvas {padding: 0; margin: 0; overflow: hidden;} </style>
|
||||
|
||||
<script src="static/p5.js"></script>
|
||||
<script src="static/p5.dom.js"></script>
|
||||
<script src="target/sketch_190507a.js" type="module"></script>
|
||||
<!-- <script src="static/p5.dom.js"></script>
|
||||
--> <script src="target/sketch_190507a.js" type="module"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
from pytop5js import *
|
||||
grid_elem = elem_size = rand_size = rand_posi = 20
|
||||
# P5 = _P5_INSTANCE
|
||||
s1 = s2 = s3 = s4 = None
|
||||
param = [20, 20, 20, 20]
|
||||
grid_elem = elem_size = rand_size = rand_posi = 20
|
||||
|
||||
def setup():
|
||||
# s1 = _P5_INSTANCE.createSlider(0, 255, 100);
|
||||
# s1.position(20, 20);
|
||||
# fullScreen()
|
||||
createCanvas(600, 600)
|
||||
# s1 = _P5_INSTANCE.createSlider(0, 255, 100)
|
||||
# s1.position(20, 20)
|
||||
# s2 = _P5_INSTANCE.createSlider(0, 255, 0);
|
||||
# s2.position(20, 50);
|
||||
# s3 = _P5_INSTANCE.createSlider(0, 255, 255);
|
||||
|
|
@ -13,9 +15,6 @@ def setup():
|
|||
# s4 = _P5_INSTANCE.createSlider(0, 255, 255);
|
||||
# s4.position(20,110);
|
||||
|
||||
|
||||
# fullScreen()
|
||||
createCanvas(600, 600)
|
||||
rectMode(CENTER) # retângulos desenhados pelo centro
|
||||
colorMode(HSB, 255, 255, 255)
|
||||
strokeWeight(2) # espessura de linha 2px
|
||||
|
|
@ -23,17 +22,11 @@ def setup():
|
|||
frameRate(30) # deixa um pouco mais lento
|
||||
|
||||
def draw():
|
||||
global grid_elem
|
||||
# global grid_elem
|
||||
# global elem_size, grid_elem, elem_size
|
||||
background(200) # fundo cinza claro
|
||||
|
||||
# # 0 a 63, número de linhas e colunas na grade
|
||||
# grid_elem = s1.value()
|
||||
# # 0 a 63, tamanho base de cada quadrado
|
||||
# elem_size = int(input.analog(2) / 16)
|
||||
# # 0 a 63, ativa faixa entre -64 e 63 para randomizar tamanho
|
||||
# rand_size = int(input.analog(3) / 16)
|
||||
# # 0 a 63, ativa faixa equivalente para randomizar a posição
|
||||
# rand_posi = int(input.analog(4) / 16)
|
||||
# grid_elem = mouseX / 10
|
||||
|
||||
# trava a randomização entre os ciclos de draw
|
||||
# mas varia com o número de colunas na grade
|
||||
|
|
@ -52,5 +45,9 @@ def draw():
|
|||
square_size,
|
||||
square_size)
|
||||
|
||||
# def mousePressed():
|
||||
# global grid_elem
|
||||
|
||||
|
||||
# This is required by pyp5js to work
|
||||
start_p5(setup, draw)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Transcrypt'ed from Python, 2019-05-07 22:22:55
|
||||
// Transcrypt'ed from Python, 2019-05-07 22:59:09
|
||||
var __name__ = 'org.transcrypt.__runtime__';
|
||||
export var __envir__ = {};
|
||||
__envir__.interpreter_name = 'python';
|
||||
|
|
|
|||
Plik diff jest za duży
Load Diff
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,896 @@
|
|||
_P5_INSTANCE = None
|
||||
|
||||
|
||||
def alpha(*args):
|
||||
return _P5_INSTANCE.alpha(*args)
|
||||
|
||||
def blue(*args):
|
||||
return _P5_INSTANCE.blue(*args)
|
||||
|
||||
def brightness(*args):
|
||||
return _P5_INSTANCE.brightness(*args)
|
||||
|
||||
def color(*args):
|
||||
return _P5_INSTANCE.color(*args)
|
||||
|
||||
def green(*args):
|
||||
return _P5_INSTANCE.green(*args)
|
||||
|
||||
def hue(*args):
|
||||
return _P5_INSTANCE.hue(*args)
|
||||
|
||||
def lerpColor(*args):
|
||||
return _P5_INSTANCE.lerpColor(*args)
|
||||
|
||||
def lightness(*args):
|
||||
return _P5_INSTANCE.lightness(*args)
|
||||
|
||||
def red(*args):
|
||||
return _P5_INSTANCE.red(*args)
|
||||
|
||||
def saturation(*args):
|
||||
return _P5_INSTANCE.saturation(*args)
|
||||
|
||||
def background(*args):
|
||||
return _P5_INSTANCE.background(*args)
|
||||
|
||||
def clear(*args):
|
||||
return _P5_INSTANCE.clear(*args)
|
||||
|
||||
def colorMode(*args):
|
||||
return _P5_INSTANCE.colorMode(*args)
|
||||
|
||||
def fill(*args):
|
||||
return _P5_INSTANCE.fill(*args)
|
||||
|
||||
def noFill(*args):
|
||||
return _P5_INSTANCE.noFill(*args)
|
||||
|
||||
def noStroke(*args):
|
||||
return _P5_INSTANCE.noStroke(*args)
|
||||
|
||||
def stroke(*args):
|
||||
return _P5_INSTANCE.stroke(*args)
|
||||
|
||||
def arc(*args):
|
||||
return _P5_INSTANCE.arc(*args)
|
||||
|
||||
def ellipse(*args):
|
||||
return _P5_INSTANCE.ellipse(*args)
|
||||
|
||||
def circle(*args):
|
||||
return _P5_INSTANCE.circle(*args)
|
||||
|
||||
def line(*args):
|
||||
return _P5_INSTANCE.line(*args)
|
||||
|
||||
def point(*args):
|
||||
return _P5_INSTANCE.point(*args)
|
||||
|
||||
def quad(*args):
|
||||
return _P5_INSTANCE.quad(*args)
|
||||
|
||||
def rect(*args):
|
||||
return _P5_INSTANCE.rect(*args)
|
||||
|
||||
def square(*args):
|
||||
return _P5_INSTANCE.square(*args)
|
||||
|
||||
def triangle(*args):
|
||||
return _P5_INSTANCE.triangle(*args)
|
||||
|
||||
def plane(*args):
|
||||
return _P5_INSTANCE.plane(*args)
|
||||
|
||||
def box(*args):
|
||||
return _P5_INSTANCE.box(*args)
|
||||
|
||||
def sphere(*args):
|
||||
return _P5_INSTANCE.sphere(*args)
|
||||
|
||||
def cylinder(*args):
|
||||
return _P5_INSTANCE.cylinder(*args)
|
||||
|
||||
def cone(*args):
|
||||
return _P5_INSTANCE.cone(*args)
|
||||
|
||||
def ellipsoid(*args):
|
||||
return _P5_INSTANCE.ellipsoid(*args)
|
||||
|
||||
def torus(*args):
|
||||
return _P5_INSTANCE.torus(*args)
|
||||
|
||||
def loadModel(*args):
|
||||
return _P5_INSTANCE.loadModel(*args)
|
||||
|
||||
def model(*args):
|
||||
return _P5_INSTANCE.model(*args)
|
||||
|
||||
def ellipseMode(*args):
|
||||
return _P5_INSTANCE.ellipseMode(*args)
|
||||
|
||||
def noSmooth(*args):
|
||||
return _P5_INSTANCE.noSmooth(*args)
|
||||
|
||||
def rectMode(*args):
|
||||
return _P5_INSTANCE.rectMode(*args)
|
||||
|
||||
def smooth(*args):
|
||||
return _P5_INSTANCE.smooth(*args)
|
||||
|
||||
def strokeCap(*args):
|
||||
return _P5_INSTANCE.strokeCap(*args)
|
||||
|
||||
def strokeJoin(*args):
|
||||
return _P5_INSTANCE.strokeJoin(*args)
|
||||
|
||||
def strokeWeight(*args):
|
||||
return _P5_INSTANCE.strokeWeight(*args)
|
||||
|
||||
def bezier(*args):
|
||||
return _P5_INSTANCE.bezier(*args)
|
||||
|
||||
def bezierDetail(*args):
|
||||
return _P5_INSTANCE.bezierDetail(*args)
|
||||
|
||||
def bezierPoint(*args):
|
||||
return _P5_INSTANCE.bezierPoint(*args)
|
||||
|
||||
def bezierTangent(*args):
|
||||
return _P5_INSTANCE.bezierTangent(*args)
|
||||
|
||||
def curve(*args):
|
||||
return _P5_INSTANCE.curve(*args)
|
||||
|
||||
def curveDetail(*args):
|
||||
return _P5_INSTANCE.curveDetail(*args)
|
||||
|
||||
def curveTightness(*args):
|
||||
return _P5_INSTANCE.curveTightness(*args)
|
||||
|
||||
def curvePoint(*args):
|
||||
return _P5_INSTANCE.curvePoint(*args)
|
||||
|
||||
def curveTangent(*args):
|
||||
return _P5_INSTANCE.curveTangent(*args)
|
||||
|
||||
def beginContour(*args):
|
||||
return _P5_INSTANCE.beginContour(*args)
|
||||
|
||||
def beginShape(*args):
|
||||
return _P5_INSTANCE.beginShape(*args)
|
||||
|
||||
def bezierVertex(*args):
|
||||
return _P5_INSTANCE.bezierVertex(*args)
|
||||
|
||||
def curveVertex(*args):
|
||||
return _P5_INSTANCE.curveVertex(*args)
|
||||
|
||||
def endContour(*args):
|
||||
return _P5_INSTANCE.endContour(*args)
|
||||
|
||||
def endShape(*args):
|
||||
return _P5_INSTANCE.endShape(*args)
|
||||
|
||||
def quadraticVertex(*args):
|
||||
return _P5_INSTANCE.quadraticVertex(*args)
|
||||
|
||||
def vertex(*args):
|
||||
return _P5_INSTANCE.vertex(*args)
|
||||
|
||||
def print(*args):
|
||||
return _P5_INSTANCE.print(*args)
|
||||
|
||||
def cursor(*args):
|
||||
return _P5_INSTANCE.cursor(*args)
|
||||
|
||||
def frameRate(*args):
|
||||
return _P5_INSTANCE.frameRate(*args)
|
||||
|
||||
def noCursor(*args):
|
||||
return _P5_INSTANCE.noCursor(*args)
|
||||
|
||||
def windowResized(*args):
|
||||
return _P5_INSTANCE.windowResized(*args)
|
||||
|
||||
def fullscreen(*args):
|
||||
return _P5_INSTANCE.fullscreen(*args)
|
||||
|
||||
def pixelDensity(*args):
|
||||
return _P5_INSTANCE.pixelDensity(*args)
|
||||
|
||||
def displayDensity(*args):
|
||||
return _P5_INSTANCE.displayDensity(*args)
|
||||
|
||||
def getURL(*args):
|
||||
return _P5_INSTANCE.getURL(*args)
|
||||
|
||||
def getURLPath(*args):
|
||||
return _P5_INSTANCE.getURLPath(*args)
|
||||
|
||||
def getURLParams(*args):
|
||||
return _P5_INSTANCE.getURLParams(*args)
|
||||
|
||||
def preload(*args):
|
||||
return _P5_INSTANCE.preload(*args)
|
||||
|
||||
def setup(*args):
|
||||
return _P5_INSTANCE.setup(*args)
|
||||
|
||||
def draw(*args):
|
||||
return _P5_INSTANCE.draw(*args)
|
||||
|
||||
def remove(*args):
|
||||
return _P5_INSTANCE.remove(*args)
|
||||
|
||||
def noLoop(*args):
|
||||
return _P5_INSTANCE.noLoop(*args)
|
||||
|
||||
def loop(*args):
|
||||
return _P5_INSTANCE.loop(*args)
|
||||
|
||||
def push(*args):
|
||||
return _P5_INSTANCE.push(*args)
|
||||
|
||||
def pop(*args):
|
||||
return _P5_INSTANCE.pop(*args)
|
||||
|
||||
def redraw(*args):
|
||||
return _P5_INSTANCE.redraw(*args)
|
||||
|
||||
def createCanvas(*args):
|
||||
return _P5_INSTANCE.createCanvas(*args)
|
||||
|
||||
def resizeCanvas(*args):
|
||||
return _P5_INSTANCE.resizeCanvas(*args)
|
||||
|
||||
def noCanvas(*args):
|
||||
return _P5_INSTANCE.noCanvas(*args)
|
||||
|
||||
def createGraphics(*args):
|
||||
return _P5_INSTANCE.createGraphics(*args)
|
||||
|
||||
def blendMode(*args):
|
||||
return _P5_INSTANCE.blendMode(*args)
|
||||
|
||||
def setAttributes(*args):
|
||||
return _P5_INSTANCE.setAttributes(*args)
|
||||
|
||||
def applyMatrix(*args):
|
||||
return _P5_INSTANCE.applyMatrix(*args)
|
||||
|
||||
def resetMatrix(*args):
|
||||
return _P5_INSTANCE.resetMatrix(*args)
|
||||
|
||||
def rotate(*args):
|
||||
return _P5_INSTANCE.rotate(*args)
|
||||
|
||||
def rotateX(*args):
|
||||
return _P5_INSTANCE.rotateX(*args)
|
||||
|
||||
def rotateY(*args):
|
||||
return _P5_INSTANCE.rotateY(*args)
|
||||
|
||||
def rotateZ(*args):
|
||||
return _P5_INSTANCE.rotateZ(*args)
|
||||
|
||||
def scale(*args):
|
||||
return _P5_INSTANCE.scale(*args)
|
||||
|
||||
def shearX(*args):
|
||||
return _P5_INSTANCE.shearX(*args)
|
||||
|
||||
def shearY(*args):
|
||||
return _P5_INSTANCE.shearY(*args)
|
||||
|
||||
def translate(*args):
|
||||
return _P5_INSTANCE.translate(*args)
|
||||
|
||||
def createStringDict(*args):
|
||||
return _P5_INSTANCE.createStringDict(*args)
|
||||
|
||||
def createNumberDict(*args):
|
||||
return _P5_INSTANCE.createNumberDict(*args)
|
||||
|
||||
def append(*args):
|
||||
return _P5_INSTANCE.append(*args)
|
||||
|
||||
def arrayCopy(*args):
|
||||
return _P5_INSTANCE.arrayCopy(*args)
|
||||
|
||||
def concat(*args):
|
||||
return _P5_INSTANCE.concat(*args)
|
||||
|
||||
def reverse(*args):
|
||||
return _P5_INSTANCE.reverse(*args)
|
||||
|
||||
def shorten(*args):
|
||||
return _P5_INSTANCE.shorten(*args)
|
||||
|
||||
def shuffle(*args):
|
||||
return _P5_INSTANCE.shuffle(*args)
|
||||
|
||||
def sort(*args):
|
||||
return _P5_INSTANCE.sort(*args)
|
||||
|
||||
def splice(*args):
|
||||
return _P5_INSTANCE.splice(*args)
|
||||
|
||||
def subset(*args):
|
||||
return _P5_INSTANCE.subset(*args)
|
||||
|
||||
def float(*args):
|
||||
return _P5_INSTANCE.float(*args)
|
||||
|
||||
def int(*args):
|
||||
return _P5_INSTANCE.int(*args)
|
||||
|
||||
def str(*args):
|
||||
return _P5_INSTANCE.str(*args)
|
||||
|
||||
def boolean(*args):
|
||||
return _P5_INSTANCE.boolean(*args)
|
||||
|
||||
def byte(*args):
|
||||
return _P5_INSTANCE.byte(*args)
|
||||
|
||||
def char(*args):
|
||||
return _P5_INSTANCE.char(*args)
|
||||
|
||||
def unchar(*args):
|
||||
return _P5_INSTANCE.unchar(*args)
|
||||
|
||||
def hex(*args):
|
||||
return _P5_INSTANCE.hex(*args)
|
||||
|
||||
def unhex(*args):
|
||||
return _P5_INSTANCE.unhex(*args)
|
||||
|
||||
def join(*args):
|
||||
return _P5_INSTANCE.join(*args)
|
||||
|
||||
def match(*args):
|
||||
return _P5_INSTANCE.match(*args)
|
||||
|
||||
def matchAll(*args):
|
||||
return _P5_INSTANCE.matchAll(*args)
|
||||
|
||||
def nf(*args):
|
||||
return _P5_INSTANCE.nf(*args)
|
||||
|
||||
def nfc(*args):
|
||||
return _P5_INSTANCE.nfc(*args)
|
||||
|
||||
def nfp(*args):
|
||||
return _P5_INSTANCE.nfp(*args)
|
||||
|
||||
def nfs(*args):
|
||||
return _P5_INSTANCE.nfs(*args)
|
||||
|
||||
def split(*args):
|
||||
return _P5_INSTANCE.split(*args)
|
||||
|
||||
def splitTokens(*args):
|
||||
return _P5_INSTANCE.splitTokens(*args)
|
||||
|
||||
def trim(*args):
|
||||
return _P5_INSTANCE.trim(*args)
|
||||
|
||||
def setMoveThreshold(*args):
|
||||
return _P5_INSTANCE.setMoveThreshold(*args)
|
||||
|
||||
def setShakeThreshold(*args):
|
||||
return _P5_INSTANCE.setShakeThreshold(*args)
|
||||
|
||||
def deviceMoved(*args):
|
||||
return _P5_INSTANCE.deviceMoved(*args)
|
||||
|
||||
def deviceTurned(*args):
|
||||
return _P5_INSTANCE.deviceTurned(*args)
|
||||
|
||||
def deviceShaken(*args):
|
||||
return _P5_INSTANCE.deviceShaken(*args)
|
||||
|
||||
def keyPressed(*args):
|
||||
return _P5_INSTANCE.keyPressed(*args)
|
||||
|
||||
def keyReleased(*args):
|
||||
return _P5_INSTANCE.keyReleased(*args)
|
||||
|
||||
def keyTyped(*args):
|
||||
return _P5_INSTANCE.keyTyped(*args)
|
||||
|
||||
def keyIsDown(*args):
|
||||
return _P5_INSTANCE.keyIsDown(*args)
|
||||
|
||||
def mouseMoved(*args):
|
||||
return _P5_INSTANCE.mouseMoved(*args)
|
||||
|
||||
def mouseDragged(*args):
|
||||
return _P5_INSTANCE.mouseDragged(*args)
|
||||
|
||||
def mousePressed(*args):
|
||||
return _P5_INSTANCE.mousePressed(*args)
|
||||
|
||||
def mouseReleased(*args):
|
||||
return _P5_INSTANCE.mouseReleased(*args)
|
||||
|
||||
def mouseClicked(*args):
|
||||
return _P5_INSTANCE.mouseClicked(*args)
|
||||
|
||||
def doubleClicked(*args):
|
||||
return _P5_INSTANCE.doubleClicked(*args)
|
||||
|
||||
def mouseWheel(*args):
|
||||
return _P5_INSTANCE.mouseWheel(*args)
|
||||
|
||||
def touchStarted(*args):
|
||||
return _P5_INSTANCE.touchStarted(*args)
|
||||
|
||||
def touchMoved(*args):
|
||||
return _P5_INSTANCE.touchMoved(*args)
|
||||
|
||||
def touchEnded(*args):
|
||||
return _P5_INSTANCE.touchEnded(*args)
|
||||
|
||||
def createImage(*args):
|
||||
return _P5_INSTANCE.createImage(*args)
|
||||
|
||||
def saveCanvas(*args):
|
||||
return _P5_INSTANCE.saveCanvas(*args)
|
||||
|
||||
def saveFrames(*args):
|
||||
return _P5_INSTANCE.saveFrames(*args)
|
||||
|
||||
def loadImage(*args):
|
||||
return _P5_INSTANCE.loadImage(*args)
|
||||
|
||||
def image(*args):
|
||||
return _P5_INSTANCE.image(*args)
|
||||
|
||||
def tint(*args):
|
||||
return _P5_INSTANCE.tint(*args)
|
||||
|
||||
def noTint(*args):
|
||||
return _P5_INSTANCE.noTint(*args)
|
||||
|
||||
def imageMode(*args):
|
||||
return _P5_INSTANCE.imageMode(*args)
|
||||
|
||||
def blend(*args):
|
||||
return _P5_INSTANCE.blend(*args)
|
||||
|
||||
def copy(*args):
|
||||
return _P5_INSTANCE.copy(*args)
|
||||
|
||||
def filter(*args):
|
||||
return _P5_INSTANCE.filter(*args)
|
||||
|
||||
def get(*args):
|
||||
return _P5_INSTANCE.get(*args)
|
||||
|
||||
def loadPixels(*args):
|
||||
return _P5_INSTANCE.loadPixels(*args)
|
||||
|
||||
def set(*args):
|
||||
return _P5_INSTANCE.set(*args)
|
||||
|
||||
def updatePixels(*args):
|
||||
return _P5_INSTANCE.updatePixels(*args)
|
||||
|
||||
def loadJSON(*args):
|
||||
return _P5_INSTANCE.loadJSON(*args)
|
||||
|
||||
def loadStrings(*args):
|
||||
return _P5_INSTANCE.loadStrings(*args)
|
||||
|
||||
def loadTable(*args):
|
||||
return _P5_INSTANCE.loadTable(*args)
|
||||
|
||||
def loadXML(*args):
|
||||
return _P5_INSTANCE.loadXML(*args)
|
||||
|
||||
def loadBytes(*args):
|
||||
return _P5_INSTANCE.loadBytes(*args)
|
||||
|
||||
def httpGet(*args):
|
||||
return _P5_INSTANCE.httpGet(*args)
|
||||
|
||||
def httpPost(*args):
|
||||
return _P5_INSTANCE.httpPost(*args)
|
||||
|
||||
def httpDo(*args):
|
||||
return _P5_INSTANCE.httpDo(*args)
|
||||
|
||||
def createWriter(*args):
|
||||
return _P5_INSTANCE.createWriter(*args)
|
||||
|
||||
def save(*args):
|
||||
return _P5_INSTANCE.save(*args)
|
||||
|
||||
def saveJSON(*args):
|
||||
return _P5_INSTANCE.saveJSON(*args)
|
||||
|
||||
def saveStrings(*args):
|
||||
return _P5_INSTANCE.saveStrings(*args)
|
||||
|
||||
def saveTable(*args):
|
||||
return _P5_INSTANCE.saveTable(*args)
|
||||
|
||||
def day(*args):
|
||||
return _P5_INSTANCE.day(*args)
|
||||
|
||||
def hour(*args):
|
||||
return _P5_INSTANCE.hour(*args)
|
||||
|
||||
def minute(*args):
|
||||
return _P5_INSTANCE.minute(*args)
|
||||
|
||||
def millis(*args):
|
||||
return _P5_INSTANCE.millis(*args)
|
||||
|
||||
def month(*args):
|
||||
return _P5_INSTANCE.month(*args)
|
||||
|
||||
def second(*args):
|
||||
return _P5_INSTANCE.second(*args)
|
||||
|
||||
def year(*args):
|
||||
return _P5_INSTANCE.year(*args)
|
||||
|
||||
def createVector(*args):
|
||||
return _P5_INSTANCE.createVector(*args)
|
||||
|
||||
def abs(*args):
|
||||
return _P5_INSTANCE.abs(*args)
|
||||
|
||||
def ceil(*args):
|
||||
return _P5_INSTANCE.ceil(*args)
|
||||
|
||||
def constrain(*args):
|
||||
return _P5_INSTANCE.constrain(*args)
|
||||
|
||||
def dist(*args):
|
||||
return _P5_INSTANCE.dist(*args)
|
||||
|
||||
def exp(*args):
|
||||
return _P5_INSTANCE.exp(*args)
|
||||
|
||||
def floor(*args):
|
||||
return _P5_INSTANCE.floor(*args)
|
||||
|
||||
def lerp(*args):
|
||||
return _P5_INSTANCE.lerp(*args)
|
||||
|
||||
def log(*args):
|
||||
return _P5_INSTANCE.log(*args)
|
||||
|
||||
def mag(*args):
|
||||
return _P5_INSTANCE.mag(*args)
|
||||
|
||||
def map(*args):
|
||||
return _P5_INSTANCE.map(*args)
|
||||
|
||||
def max(*args):
|
||||
return _P5_INSTANCE.max(*args)
|
||||
|
||||
def min(*args):
|
||||
return _P5_INSTANCE.min(*args)
|
||||
|
||||
def norm(*args):
|
||||
return _P5_INSTANCE.norm(*args)
|
||||
|
||||
def pow(*args):
|
||||
return _P5_INSTANCE.pow(*args)
|
||||
|
||||
def round(*args):
|
||||
return _P5_INSTANCE.round(*args)
|
||||
|
||||
def sq(*args):
|
||||
return _P5_INSTANCE.sq(*args)
|
||||
|
||||
def sqrt(*args):
|
||||
return _P5_INSTANCE.sqrt(*args)
|
||||
|
||||
def noise(*args):
|
||||
return _P5_INSTANCE.noise(*args)
|
||||
|
||||
def noiseDetail(*args):
|
||||
return _P5_INSTANCE.noiseDetail(*args)
|
||||
|
||||
def noiseSeed(*args):
|
||||
return _P5_INSTANCE.noiseSeed(*args)
|
||||
|
||||
def randomSeed(*args):
|
||||
return _P5_INSTANCE.randomSeed(*args)
|
||||
|
||||
def random(*args):
|
||||
return _P5_INSTANCE.random(*args)
|
||||
|
||||
def randomGaussian(*args):
|
||||
return _P5_INSTANCE.randomGaussian(*args)
|
||||
|
||||
def acos(*args):
|
||||
return _P5_INSTANCE.acos(*args)
|
||||
|
||||
def asin(*args):
|
||||
return _P5_INSTANCE.asin(*args)
|
||||
|
||||
def atan(*args):
|
||||
return _P5_INSTANCE.atan(*args)
|
||||
|
||||
def atan2(*args):
|
||||
return _P5_INSTANCE.atan2(*args)
|
||||
|
||||
def cos(*args):
|
||||
return _P5_INSTANCE.cos(*args)
|
||||
|
||||
def sin(*args):
|
||||
return _P5_INSTANCE.sin(*args)
|
||||
|
||||
def tan(*args):
|
||||
return _P5_INSTANCE.tan(*args)
|
||||
|
||||
def degrees(*args):
|
||||
return _P5_INSTANCE.degrees(*args)
|
||||
|
||||
def radians(*args):
|
||||
return _P5_INSTANCE.radians(*args)
|
||||
|
||||
def angleMode(*args):
|
||||
return _P5_INSTANCE.angleMode(*args)
|
||||
|
||||
def textAlign(*args):
|
||||
return _P5_INSTANCE.textAlign(*args)
|
||||
|
||||
def textLeading(*args):
|
||||
return _P5_INSTANCE.textLeading(*args)
|
||||
|
||||
def textSize(*args):
|
||||
return _P5_INSTANCE.textSize(*args)
|
||||
|
||||
def textStyle(*args):
|
||||
return _P5_INSTANCE.textStyle(*args)
|
||||
|
||||
def textWidth(*args):
|
||||
return _P5_INSTANCE.textWidth(*args)
|
||||
|
||||
def textAscent(*args):
|
||||
return _P5_INSTANCE.textAscent(*args)
|
||||
|
||||
def textDescent(*args):
|
||||
return _P5_INSTANCE.textDescent(*args)
|
||||
|
||||
def loadFont(*args):
|
||||
return _P5_INSTANCE.loadFont(*args)
|
||||
|
||||
def text(*args):
|
||||
return _P5_INSTANCE.text(*args)
|
||||
|
||||
def textFont(*args):
|
||||
return _P5_INSTANCE.textFont(*args)
|
||||
|
||||
def orbitControl(*args):
|
||||
return _P5_INSTANCE.orbitControl(*args)
|
||||
|
||||
def debugMode(*args):
|
||||
return _P5_INSTANCE.debugMode(*args)
|
||||
|
||||
def noDebugMode(*args):
|
||||
return _P5_INSTANCE.noDebugMode(*args)
|
||||
|
||||
def ambientLight(*args):
|
||||
return _P5_INSTANCE.ambientLight(*args)
|
||||
|
||||
def directionalLight(*args):
|
||||
return _P5_INSTANCE.directionalLight(*args)
|
||||
|
||||
def pointLight(*args):
|
||||
return _P5_INSTANCE.pointLight(*args)
|
||||
|
||||
def lights(*args):
|
||||
return _P5_INSTANCE.lights(*args)
|
||||
|
||||
def loadShader(*args):
|
||||
return _P5_INSTANCE.loadShader(*args)
|
||||
|
||||
def createShader(*args):
|
||||
return _P5_INSTANCE.createShader(*args)
|
||||
|
||||
def shader(*args):
|
||||
return _P5_INSTANCE.shader(*args)
|
||||
|
||||
def resetShader(*args):
|
||||
return _P5_INSTANCE.resetShader(*args)
|
||||
|
||||
def normalMaterial(*args):
|
||||
return _P5_INSTANCE.normalMaterial(*args)
|
||||
|
||||
def texture(*args):
|
||||
return _P5_INSTANCE.texture(*args)
|
||||
|
||||
def textureMode(*args):
|
||||
return _P5_INSTANCE.textureMode(*args)
|
||||
|
||||
def textureWrap(*args):
|
||||
return _P5_INSTANCE.textureWrap(*args)
|
||||
|
||||
def ambientMaterial(*args):
|
||||
return _P5_INSTANCE.ambientMaterial(*args)
|
||||
|
||||
def specularMaterial(*args):
|
||||
return _P5_INSTANCE.specularMaterial(*args)
|
||||
|
||||
def shininess(*args):
|
||||
return _P5_INSTANCE.shininess(*args)
|
||||
|
||||
def camera(*args):
|
||||
return _P5_INSTANCE.camera(*args)
|
||||
|
||||
def perspective(*args):
|
||||
return _P5_INSTANCE.perspective(*args)
|
||||
|
||||
def ortho(*args):
|
||||
return _P5_INSTANCE.ortho(*args)
|
||||
|
||||
def createCamera(*args):
|
||||
return _P5_INSTANCE.createCamera(*args)
|
||||
|
||||
def setCamera(*args):
|
||||
return _P5_INSTANCE.setCamera(*args)
|
||||
|
||||
|
||||
HALF_PI = None
|
||||
PI = None
|
||||
QUARTER_PI = None
|
||||
TAU = None
|
||||
TWO_PI = None
|
||||
DEGREES = None
|
||||
RADIANS = None
|
||||
CLOSE = None
|
||||
RGB = None
|
||||
HSB = None
|
||||
CMYK = None
|
||||
TOP = None
|
||||
BOTTOM = None
|
||||
CENTER = None
|
||||
LEFT = None
|
||||
RIGHT = None
|
||||
SHIFT = None
|
||||
WEBGL = None
|
||||
frameCount = None
|
||||
focused = None
|
||||
displayWidth = None
|
||||
displayHeight = None
|
||||
windowWidth = None
|
||||
windowHeight = None
|
||||
width = None
|
||||
height = None
|
||||
disableFriendlyErrors = None
|
||||
deviceOrientation = None
|
||||
accelerationX = None
|
||||
accelerationY = None
|
||||
accelerationZ = None
|
||||
pAccelerationX = None
|
||||
pAccelerationY = None
|
||||
pAccelerationZ = None
|
||||
rotationX = None
|
||||
rotationY = None
|
||||
rotationZ = None
|
||||
pRotationX = None
|
||||
pRotationY = None
|
||||
pRotationZ = None
|
||||
turnAxis = None
|
||||
keyIsPressed = None
|
||||
key = None
|
||||
keyCode = None
|
||||
mouseX = None
|
||||
mouseY = None
|
||||
pmouseX = None
|
||||
pmouseY = None
|
||||
winMouseX = None
|
||||
winMouseY = None
|
||||
pwinMouseX = None
|
||||
pwinMouseY = None
|
||||
mouseButton = None
|
||||
mouseIsPressed = None
|
||||
touches = None
|
||||
pixels = None
|
||||
|
||||
def pre_draw(p5_instance, draw_func):
|
||||
"""
|
||||
We need to run this before the actual draw to insert and update p5 env variables
|
||||
"""
|
||||
global HALF_PI, PI, QUARTER_PI, TAU, TWO_PI, DEGREES, RADIANS, CLOSE, RGB, HSB, CMYK, TOP, BOTTOM, CENTER, LEFT, RIGHT, SHIFT, WEBGL, frameCount, focused, displayWidth, displayHeight, windowWidth, windowHeight, width, height, disableFriendlyErrors, deviceOrientation, accelerationX, accelerationY, accelerationZ, pAccelerationX, pAccelerationY, pAccelerationZ, rotationX, rotationY, rotationZ, pRotationX, pRotationY, pRotationZ, turnAxis, keyIsPressed, key, keyCode, mouseX, mouseY, pmouseX, pmouseY, winMouseX, winMouseY, pwinMouseX, pwinMouseY, mouseButton, mouseIsPressed, touches, pixels
|
||||
|
||||
HALF_PI = p5_instance.HALF_PI
|
||||
PI = p5_instance.PI
|
||||
QUARTER_PI = p5_instance.QUARTER_PI
|
||||
TAU = p5_instance.TAU
|
||||
TWO_PI = p5_instance.TWO_PI
|
||||
DEGREES = p5_instance.DEGREES
|
||||
RADIANS = p5_instance.RADIANS
|
||||
CLOSE = p5_instance.CLOSE
|
||||
RGB = p5_instance.RGB
|
||||
HSB = p5_instance.HSB
|
||||
CMYK = p5_instance.CMYK
|
||||
TOP = p5_instance.TOP
|
||||
BOTTOM = p5_instance.BOTTOM
|
||||
CENTER = p5_instance.CENTER
|
||||
LEFT = p5_instance.LEFT
|
||||
RIGHT = p5_instance.RIGHT
|
||||
SHIFT = p5_instance.SHIFT
|
||||
WEBGL = p5_instance.WEBGL
|
||||
frameCount = p5_instance.frameCount
|
||||
focused = p5_instance.focused
|
||||
displayWidth = p5_instance.displayWidth
|
||||
displayHeight = p5_instance.displayHeight
|
||||
windowWidth = p5_instance.windowWidth
|
||||
windowHeight = p5_instance.windowHeight
|
||||
width = p5_instance.width
|
||||
height = p5_instance.height
|
||||
disableFriendlyErrors = p5_instance.disableFriendlyErrors
|
||||
deviceOrientation = p5_instance.deviceOrientation
|
||||
accelerationX = p5_instance.accelerationX
|
||||
accelerationY = p5_instance.accelerationY
|
||||
accelerationZ = p5_instance.accelerationZ
|
||||
pAccelerationX = p5_instance.pAccelerationX
|
||||
pAccelerationY = p5_instance.pAccelerationY
|
||||
pAccelerationZ = p5_instance.pAccelerationZ
|
||||
rotationX = p5_instance.rotationX
|
||||
rotationY = p5_instance.rotationY
|
||||
rotationZ = p5_instance.rotationZ
|
||||
pRotationX = p5_instance.pRotationX
|
||||
pRotationY = p5_instance.pRotationY
|
||||
pRotationZ = p5_instance.pRotationZ
|
||||
turnAxis = p5_instance.turnAxis
|
||||
keyIsPressed = p5_instance.keyIsPressed
|
||||
key = p5_instance.key
|
||||
keyCode = p5_instance.keyCode
|
||||
mouseX = p5_instance.mouseX
|
||||
mouseY = p5_instance.mouseY
|
||||
pmouseX = p5_instance.pmouseX
|
||||
pmouseY = p5_instance.pmouseY
|
||||
winMouseX = p5_instance.winMouseX
|
||||
winMouseY = p5_instance.winMouseY
|
||||
pwinMouseX = p5_instance.pwinMouseX
|
||||
pwinMouseY = p5_instance.pwinMouseY
|
||||
mouseButton = p5_instance.mouseButton
|
||||
mouseIsPressed = p5_instance.mouseIsPressed
|
||||
touches = p5_instance.touches
|
||||
pixels = p5_instance.pixels
|
||||
|
||||
return draw_func()
|
||||
|
||||
|
||||
def global_p5_injection(p5_sketch):
|
||||
"""
|
||||
Injects the p5js's skecth instance as a global variable to setup and draw functions
|
||||
"""
|
||||
|
||||
def decorator(f):
|
||||
|
||||
def wrapper():
|
||||
global _P5_INSTANCE
|
||||
_P5_INSTANCE = p5_sketch
|
||||
return pre_draw(_P5_INSTANCE, f)
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def start_p5(setup_func, draw_func):
|
||||
"""
|
||||
This is the entrypoint function. It accepts 2 parameters:
|
||||
|
||||
- setup_func: a Python setup callable
|
||||
- draw_func: a Python draw callable
|
||||
|
||||
This method gets the p5js's sketch instance and injects them
|
||||
"""
|
||||
|
||||
def sketch_setup(p5_sketch):
|
||||
p5_sketch.setup = global_p5_injection(p5_sketch)(setup_func)
|
||||
p5_sketch.draw = global_p5_injection(p5_sketch)(draw_func)
|
||||
|
||||
return __new__ (p5(sketch_setup, 'sketch-holder'))
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
// Transcrypt'ed from Python, 2019-05-07 22:59:10
|
||||
import {AssertionError, AttributeError, BaseException, DeprecationWarning, Exception, IndexError, IterableError, KeyError, NotImplementedError, RuntimeWarning, StopIteration, UserWarning, ValueError, Warning, __JsIterator__, __PyIterator__, __Terminal__, __add__, __and__, __call__, __class__, __envir__, __eq__, __floordiv__, __ge__, __get__, __getcm__, __getitem__, __getslice__, __getsm__, __gt__, __i__, __iadd__, __iand__, __idiv__, __ijsmod__, __ilshift__, __imatmul__, __imod__, __imul__, __in__, __init__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __jsUsePyNext__, __jsmod__, __k__, __kwargtrans__, __le__, __lshift__, __lt__, __matmul__, __mergefields__, __mergekwargtrans__, __mod__, __mul__, __ne__, __neg__, __nest__, __or__, __pow__, __pragma__, __proxy__, __pyUseJsNext__, __rshift__, __setitem__, __setproperty__, __setslice__, __sort__, __specialattrib__, __sub__, __super__, __t__, __terminal__, __truediv__, __withblock__, __xor__, all, any, assert, bool, bytearray, bytes, callable, chr, deepcopy, delattr, dict, dir, divmod, enumerate, getattr, hasattr, input, isinstance, issubclass, len, list, object, ord, property, py_TypeError, py_iter, py_metatype, py_next, py_reversed, py_typeof, range, repr, setattr, sorted, sum, tuple, zip} from './org.transcrypt.__runtime__.js';
|
||||
import {BOTTOM, CENTER, CLOSE, CMYK, DEGREES, HALF_PI, HSB, LEFT, PI, QUARTER_PI, RADIANS, RGB, RIGHT, SHIFT, TAU, TOP, TWO_PI, WEBGL, _P5_INSTANCE, abs, accelerationX, accelerationY, accelerationZ, acos, alpha, ambientLight, ambientMaterial, angleMode, append, applyMatrix, arc, arrayCopy, asin, atan, atan2, background, beginContour, beginShape, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blend, blendMode, blue, boolean, box, brightness, byte, camera, ceil, char, circle, color, colorMode, concat, cone, constrain, copy, cos, createCamera, createCanvas, createGraphics, createImage, createNumberDict, createShader, createStringDict, createVector, createWriter, cursor, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, cylinder, day, debugMode, degrees, deviceMoved, deviceOrientation, deviceShaken, deviceTurned, directionalLight, disableFriendlyErrors, displayDensity, displayHeight, displayWidth, dist, doubleClicked, ellipse, ellipseMode, ellipsoid, endContour, endShape, exp, fill, filter, float, floor, focused, frameCount, frameRate, fullscreen, getURL, getURLParams, getURLPath, global_p5_injection, green, height, hex, hour, httpDo, httpGet, httpPost, hue, image, imageMode, int, join, key, keyCode, keyIsDown, keyIsPressed, keyPressed, keyReleased, keyTyped, lerp, lerpColor, lightness, lights, line, loadBytes, loadFont, loadImage, loadJSON, loadModel, loadPixels, loadShader, loadStrings, loadTable, loadXML, log, loop, mag, map, match, matchAll, max, millis, min, minute, model, month, mouseButton, mouseClicked, mouseDragged, mouseIsPressed, mouseMoved, mousePressed, mouseReleased, mouseWheel, mouseX, mouseY, nf, nfc, nfp, nfs, noCanvas, noCursor, noDebugMode, noFill, noLoop, noSmooth, noStroke, noTint, noise, noiseDetail, noiseSeed, norm, normalMaterial, orbitControl, ortho, pAccelerationX, pAccelerationY, pAccelerationZ, pRotationX, pRotationY, pRotationZ, perspective, pixelDensity, pixels, plane, pmouseX, pmouseY, point, pointLight, pow, pre_draw, preload, print, push, pwinMouseX, pwinMouseY, py_clear, py_get, py_pop, py_sort, py_split, quad, quadraticVertex, radians, random, randomGaussian, randomSeed, rect, rectMode, red, redraw, remove, resetMatrix, resetShader, resizeCanvas, reverse, rotate, rotateX, rotateY, rotateZ, rotationX, rotationY, rotationZ, round, saturation, save, saveCanvas, saveFrames, saveJSON, saveStrings, saveTable, scale, second, set, setAttributes, setCamera, setMoveThreshold, setShakeThreshold, shader, shearX, shearY, shininess, shorten, shuffle, sin, smooth, specularMaterial, sphere, splice, splitTokens, sq, sqrt, square, start_p5, str, stroke, strokeCap, strokeJoin, strokeWeight, subset, tan, text, textAlign, textAscent, textDescent, textFont, textLeading, textSize, textStyle, textWidth, texture, textureMode, textureWrap, tint, torus, touchEnded, touchMoved, touchStarted, touches, translate, triangle, trim, turnAxis, unchar, unhex, updatePixels, vertex, width, winMouseX, winMouseY, windowHeight, windowResized, windowWidth, year} from './pytop5js.js';
|
||||
var __name__ = '__main__';
|
||||
export var param = list ([20, 20, 20, 20]);
|
||||
var __left0__ = 20;
|
||||
export var grid_elem = __left0__;
|
||||
export var elem_size = __left0__;
|
||||
export var rand_size = __left0__;
|
||||
export var rand_posi = __left0__;
|
||||
export var setup = function () {
|
||||
createCanvas (600, 600);
|
||||
rectMode (CENTER);
|
||||
colorMode (HSB, 255, 255, 255);
|
||||
strokeWeight (2);
|
||||
noFill ();
|
||||
frameRate (30);
|
||||
};
|
||||
export var draw = function () {
|
||||
background (200);
|
||||
randomSeed (int (grid_elem / 4));
|
||||
var spac_size = int (width / (grid_elem + 1));
|
||||
for (var x of range (spac_size / 2, width, spac_size)) {
|
||||
for (var y of range (spac_size / 2, width, spac_size)) {
|
||||
var square_size = elem_size + rand_size * random (-(1), 1);
|
||||
stroke (square_size * 3, 255, 128);
|
||||
rect (x + rand_posi * random (-(1), 1), y + rand_posi * random (-(1), 1), square_size, square_size);
|
||||
}
|
||||
}
|
||||
};
|
||||
start_p5 (setup, draw);
|
||||
|
||||
//# sourceMappingURL=sketch_190507a.map
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "sketch_190507a.js",
|
||||
"sources": [
|
||||
"sketch_190507a.py"
|
||||
],
|
||||
"mappings": "AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AAEA;AAUA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAGA;AAMA;AAEA;AAEA;AAEA;AAEA;AACA;AAEA;AAAA;AAAA;AAAA;AASA;AApDA"
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
from pytop5js import *
|
||||
# P5 = _P5_INSTANCE
|
||||
param = [20, 20, 20, 20]
|
||||
grid_elem = elem_size = rand_size = rand_posi = 20
|
||||
|
||||
def setup():
|
||||
# fullScreen()
|
||||
createCanvas(600, 600)
|
||||
# s1 = _P5_INSTANCE.createSlider(0, 255, 100)
|
||||
# s1.position(20, 20)
|
||||
# s2 = _P5_INSTANCE.createSlider(0, 255, 0);
|
||||
# s2.position(20, 50);
|
||||
# s3 = _P5_INSTANCE.createSlider(0, 255, 255);
|
||||
# s3.position(20, 80);
|
||||
# s4 = _P5_INSTANCE.createSlider(0, 255, 255);
|
||||
# s4.position(20,110);
|
||||
|
||||
rectMode(CENTER) # retângulos desenhados pelo centro
|
||||
colorMode(HSB, 255, 255, 255)
|
||||
strokeWeight(2) # espessura de linha 2px
|
||||
noFill() # sem preenchimento
|
||||
frameRate(30) # deixa um pouco mais lento
|
||||
|
||||
def draw():
|
||||
# global grid_elem
|
||||
# global elem_size, grid_elem, elem_size
|
||||
background(200) # fundo cinza claro
|
||||
|
||||
# grid_elem = mouseX / 10
|
||||
|
||||
# trava a randomização entre os ciclos de draw
|
||||
# mas varia com o número de colunas na grade
|
||||
randomSeed(int(grid_elem / 4))
|
||||
# calcula o espaçamento entre os quadrandos
|
||||
spac_size = int(width / (grid_elem + 1))
|
||||
# para cada coluna um x
|
||||
for x in range(spac_size / 2, width, spac_size):
|
||||
# para cada linha um y
|
||||
for y in range(spac_size / 2, width, spac_size):
|
||||
# sorteia um tamanho (se o rand_size > 0)
|
||||
square_size = elem_size + rand_size * random(-1, 1)
|
||||
stroke(square_size * 3, 255, 128)
|
||||
rect(x + rand_posi * random(-1, 1), # desenha um quadrado
|
||||
y + rand_posi * random(-1, 1),
|
||||
square_size,
|
||||
square_size)
|
||||
|
||||
# def mousePressed():
|
||||
# global grid_elem
|
||||
|
||||
|
||||
# This is required by pyp5js to work
|
||||
start_p5(setup, draw)
|
||||
Ładowanie…
Reference in New Issue