mirror of
https://github.com/Xevion/processing-projects.git
synced 2025-12-06 01:15:57 -06:00
Rotational Calculator project
This commit is contained in:
@@ -18,4 +18,6 @@ Other sketches without any specific purpose. If enough fit into a specific categ
|
|||||||
|
|
||||||
- **Graph-Theory** - A simple project closely mimicing the particle.js library.
|
- **Graph-Theory** - A simple project closely mimicing the particle.js library.
|
||||||
|
|
||||||
- **Old_Lines** - A short script connecting your current mouse position to that of yours moments ago.
|
- **Old_Lines** - A short script connecting your current mouse position to that of yours moments ago.
|
||||||
|
|
||||||
|
- **Rotating_Calculator** - Displays how Processing.py calculates the final position of an object given a rotational value. Mostly a test for me, trying to understand why some of my projects would rotate in strange and confusing ways.
|
||||||
29
other/Rotation_Calculator/Rotation_Calculator.pyde
Normal file
29
other/Rotation_Calculator/Rotation_Calculator.pyde
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
def setup():
|
||||||
|
size(500, 500)
|
||||||
|
|
||||||
|
def drawLine(i):
|
||||||
|
stroke(0)
|
||||||
|
fill(0)
|
||||||
|
translate(width/2, height/2)
|
||||||
|
rotate(radians(i))
|
||||||
|
line(0, 0, 240, 0)
|
||||||
|
textSize(15)
|
||||||
|
text(i, 240, 0)
|
||||||
|
resetMatrix()
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
def draw():
|
||||||
|
background(204)
|
||||||
|
global i
|
||||||
|
i += 1
|
||||||
|
i = i % 360
|
||||||
|
if i % 90 == 0:
|
||||||
|
fill(255, 0, 0)
|
||||||
|
else:
|
||||||
|
fill(0)
|
||||||
|
textAlign(CENTER, CENTER)
|
||||||
|
textSize(40)
|
||||||
|
text(str(i), 500-40, 500-20)
|
||||||
|
drawLine(i)
|
||||||
|
for x in range(0, 360, 15):
|
||||||
|
drawLine(x)
|
||||||
2
other/Rotation_Calculator/sketch.properties
Normal file
2
other/Rotation_Calculator/sketch.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mode=Python
|
||||||
|
mode.id=jycessing.mode.PythonMode
|
||||||
Reference in New Issue
Block a user