示例#1
0
elapsedTime = 0.0
elapsedTimeSquares = 0.0
startColorIndex = 1
endColorIndex = 2
scaleFactor = 10
squareScaleFactor = 2.0


rows = [ 0.0069, 0.055, 0.102, 0.151, 0.234926, 0.284, 0.331, 0.38, 0.479, 0.528, 0.575, 0.625, 0.707, 0.756, 0.803, 0.899, 0.948, 0.994]
cols = [ 0.026, 0.107, 0.186, 0.268089, 0.35, 0.428, 0.508, 0.591, 0.67, 0.751, 0.831, 0.912, 0.99]


content = Content("MinimalSquares")
content.FBO_SIZE = (size,size) #optional: define size of FBO, default=(100,100)

content.add_parameter("color1", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color2", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color3", type="color", value=ofColor(255, 255, 255))
content.add_parameter("change_hue", value=True)
content.add_parameter("color_speed", min=0.00, max=1.0, value=0.1)
content.add_parameter("speed", min=0.0, max=1.0, value=0.1)
content.add_parameter("num_squares", min=0, max=20, value=1)
content.add_parameter("stage_mode", value=False)


class Square:
    size = 570
    height = 4
    width = 4
    thickness = 2
    alpha = 0
示例#2
0
shader = ofShader()

temp_dir = mkdtemp()
frag_file = os.path.join(temp_dir, 's.frag')
vert_file = os.path.join(temp_dir, 's.vert')
shader_file_of = os.path.join(temp_dir, 's')

#a global variable
color = ofColor(255)
elapsedTime = 0.0
startColorIndex = 1
endColorIndex = 2
scaleFactor = 10
speedFactor = 0.6

content.add_parameter("color1", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color2", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color3", type="color", value=ofColor(255, 255, 255))
content.add_parameter("change_hue", value=True)
content.add_parameter("color_speed", min=0.00, max=1.0, value=0.1)
content.add_parameter("speed", min=0.01, max=1.0, value=0.5)
content.add_parameter("particles_direction", min=0, max=3, value=0)
content.add_parameter("stage_mode", value=False)


@content.parameter_changed('change_hue')
def parameter_changed(value):
    """
    This function is called every time a a_integer is changed.
    We get the new value as an argument
    """
示例#3
0
#a global variable
num_modes = 3
elapsedTime = 0.0
change_time = 350
width = 600
height= 100
content.FBO_SIZE = (width,height) #optional: define size of FBO, default=(100,100)
targetAlpha = 1.0
currentAlpha = 0.0
energy = 1.0
fbo = ofFbo()
fboVisuals = ofFbo()
shader = ofShader()
mode = 0

content.add_parameter("gamma", min=0.0, max=1.0, value=0.85)


def setup():
    """
    This will be called at the beggining, you set your stuff here
    """

    global size, aurora

    aurora = aurora.Aurora(width,height)

    ofEnableAlphaBlending()
    fbo.allocate(width,height)
    fbo.begin()
    ofClear(255)
示例#4
0
import os.path
from random import randint
import imp

content = Content("ProtoPixeFrames")

print "ProtoPixeFrames"

color = ofColor(255)
shader = ofShader()
targetAlpha = 1.0
currentAlpha = 0.0

size = 10
content.FBO_SIZE = (size, size)
content.add_parameter("gamma", min=0.0, max=1.0, value=0.9)
content.add_parameter("Color", type="color", value=ofColor(255, 255, 255))

rainbow_file = content.add_asset("rainbow.py")
rainbow = imp.load_source('rainbow', rainbow_file)

square_file = content.add_asset("square.py")
square = imp.load_source('square', square_file)


def setup():
    """
    This will be called at the beggining, you set your stuff here
    """

    global rainbow, square
示例#5
0
from random import randint
import math

print "BlackoutSections"

#a global variable
size = 170
currentTransparency = []
targetTransparency = []
numSections = 5
onTransparency = 10

content = Content("BlackoutSections")
content.FBO_SIZE = (170, 170)  #optional: define size of FBO, default=(100,100)

content.add_parameter("_1", value=False)
content.add_parameter("_2", value=False)
content.add_parameter("_3", value=False)
content.add_parameter("_4", value=False)
content.add_parameter("_5", value=False)


@content.parameter_changed('_1')
def parameter_changed(value):

    global targetTransparency, onTransparency

    if value == True:
        targetTransparency[0] = 255
    else:
        targetTransparency[0] = onTransparency
示例#6
0
import os.path
from tempfile import mkdtemp

content = Content("Ripple")

side = 256
content.FBO_SIZE = (side,side)
shaderfile = content.add_asset('shader')
shader = ofShader()

temp_dir = mkdtemp()
frag_file = os.path.join(temp_dir,'s.frag')
vert_file = os.path.join(temp_dir,'s.vert')
shader_file_of = os.path.join(temp_dir,'s')

content.add_parameter("speed", min=0.01, max=1.0, value=0.033)

def setup():
    if content['shader path']:
        shader_path_changed(content['shader path'])

    with open(frag_file,'w') as f:
        f.write(frag_contents_prefix)
        f.write(frag_contents)
        f.write(frag_contents_suffix)
    with open(vert_file,'w') as f:
        f.write(vert_contents)
    shader.load(shader_file_of)

def draw():
示例#7
0
num_modes = 3
elapsedTime = 0.0
change_time = 350
width = 600
height = 100
content.FBO_SIZE = (width, height
                    )  #optional: define size of FBO, default=(100,100)
targetAlpha = 1.0
currentAlpha = 0.0
energy = 1.0
fbo = ofFbo()
fboVisuals = ofFbo()
shader = ofShader()
mode = 0

content.add_parameter("gamma", min=0.0, max=1.0, value=0.9)
content.add_parameter("enableSunset", value=True)
content.add_parameter("enableClouds", value=True)
content.add_parameter("enableAurora", value=True)


def setup():
    """
    This will be called at the beggining, you set your stuff here
    """

    global size, sunset, clouds, aurora

    sunset = sunset.Sunset(width, height)
    clouds = clouds.Clouds(width, height)
    aurora = aurora.Aurora(width, height)
示例#8
0
#a global variable
elapsedTime = 0.0
change_time = 60
size = 200
content.FBO_SIZE = (size, size
                    )  #optional: define size of FBO, default=(100,100)
targetAlpha = 1.0
currentAlpha = 0.0
currentColor = ofColor(255)
previousColor = ofColor(0)
shader = ofShader()
colorIndex = 0
modeIndex = 0

content.add_parameter("gamma", min=0.0, max=1.0, value=0.6)
content.add_parameter("enableSparkles", value=True)
content.add_parameter("enableRainbow", value=True)
content.add_parameter("enableFade", value=True)
content.add_parameter("enableWaves", value=True)
content.add_parameter("enableCircles", value=True)
content.add_parameter("Color", type="color", value=ofColor(255, 255, 255))


def setup():
    """
    This will be called at the beggining, you set your stuff here
    """

    global size, sparkles, rainbow, fade, waves, circles
示例#9
0
from protopixel import Content
from openframeworks import *

import os.path
from tempfile import mkdtemp

content = Content("Shader")
content.add_parameter("shader path", type="filepath")
content.add_parameter("speed", value=1.0, min=0.0, max=10.0)
content.add_parameter("reset 24h", value=False)

side = 256
content.FBO_SIZE = (side,side)
shader = ofShader()

temp_dir = mkdtemp()
frag_file = os.path.join(temp_dir,'s.frag')
vert_file = os.path.join(temp_dir,'s.vert')
shader_file_of = os.path.join(temp_dir,'s')

def setup():
    if content['shader path']:
        shader_path_changed(content['shader path'])

def draw():
    ofClear(0,0,0,255)
    if shader.isLoaded():
        if content['reset 24h']:
            time = ofGetElapsedTimeMillis() % 86400000
            time = time / 1000.0
        else:
示例#10
0
from openframeworks import *
from protopixel import Content
from random import randint
import math

print "Blackout"

#a global variable
size = 170
currentTransparency = 0
targetTransparency = 0

content = Content("Blackout")
content.FBO_SIZE = (170, 170)  #optional: define size of FBO, default=(100,100)

content.add_parameter("On", value=False)


@content.parameter_changed('On')
def parameter_changed(value):
    """
    This function is called every time a a_integer is changed.
    We get the new value as an argument
    """
    global targetTransparency

    if value == True:
        targetTransparency = 255
        print "Global Blackout ON "
    else:
        targetTransparency = 0
示例#11
0
temp_dir = mkdtemp()
frag_file = os.path.join(temp_dir, 's.frag')
vert_file = os.path.join(temp_dir, 's.vert')
shader_file_of = os.path.join(temp_dir, 's')

#a global variable
color = ofColor(255)
elapsedTime = 0.0
startColorIndex = 1
endColorIndex = 2
scaleFactor = 10
currentTime = 0
timeFactor = 0.5
speedFactor = 2.0

content.add_parameter("color1", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color2", type="color", value=ofColor(255, 255, 255))
content.add_parameter("color3", type="color", value=ofColor(255, 255, 255))
content.add_parameter("change_hue", value=True)
content.add_parameter("color_speed", min=0.00, max=1.0, value=0.1)
content.add_parameter("speed", min=0.0, max=1.0, value=0.3)
content.add_parameter("noise_grain", min=0.00, max=1.0, value=0.1)
content.add_parameter("stage_mode", value=False)


@content.parameter_changed('change_hue')
def parameter_changed(value):
    """
    This function is called every time a a_integer is changed.
    We get the new value as an argument
    """
示例#12
0
import struct
import sys

import time
from time import time as tt
import numpy as np
import os.path

from openframeworks import *
from protopixel import Content

UDP_IP = "192.168.8.237"
UDP_PORT = 2390

content = Content('Virtual controller')
content.add_parameter("FPS_LIMIT", min=0, max=60, value=30)

content.add_parameter("Controller1", value=False)
content.add_parameter("IP_1", value="192.168.8.237")

content.add_parameter("Controller2", value=False)
content.add_parameter("IP_2", value="192.168.8.238")

content.add_parameter("Controller3", value=False)
content.add_parameter("IP_3", value="192.168.8.239")

content.add_parameter("Controller4", value=False)
content.add_parameter("IP_4", value="192.168.8.240")

content.add_parameter("Controller5", value=False)
content.add_parameter("IP_5", value="192.168.8.241")
示例#13
0
#   A simple string
# filepath
#   A string, but a button for opening a file will appear
# color
#   An instance of ofColor (r,g,b,a).
# button
#   A function that can be triggered

# Use content.add_parameter to define all parameters of the script that will be exposed to the GUI
# The first argument is the name of the variable,
# the keywords are the options.
# Booleans do not have options other that its initial value.
# Initial value is optional.
# Pay attention to the type of the value. If you mix them you will
# get incorrect types (1 vs 1.0 for int and float, for instace)
content.add_parameter("a_boolean", value=True)

# Integer can also define min and max of its value.
content.add_parameter("a_integer", min=0, max=5, value=5)

# Float works the same way as int.
# For both, `min` and `max` are optional.
content.add_parameter("a_float", min=0.0, max=5.0, value=0.0)

# Strings do not have options.
content.add_parameter("a_string", value="Hello")

# For filepaths you have to specify its type.
# type can also be specified for the previous types, they are otherwise inferred.
content.add_parameter("a_filepath", type="filepath")
示例#14
0
# This file is part of the ProtoPixel Library
from protopixel import Content
from openframeworks import *
from collections import namedtuple

content = Content('Paint')
content.add_parameter('size', value=300, min=0, max=1024)
content.add_parameter('clear', type='button')

firstrun = True
Finger = namedtuple('Finger', ['x', 'y', 'size', 'color'])
fingers = []

content.FBO_SIZE = (300, 300)
content.web_path('paint')


@content.parameter_changed('size')
def size_changed(size):
    content.FBO_SIZE = (size, size)


@content.websocket.receive
def websocket(ws, data):
    if data['event'] == "draw":
        getfinger(data['x'] * content.FBO_SIZE[0],
                  data['y'] * content.FBO_SIZE[1], data['color'])
    elif data['event'] == "clear":
        clear()