Exemple #1
0
def frameStart(frame):	
    global minsize,growspeed,shiftspeed,spoint
    if c[0].size<4.5:
        if flipflop==len(ranbowlist):
            flipflop=0
        c.insert(0,vox_shapes.sphere(spoint,ranbowlist[flipflop],size=5))
        flipflop = flipflop+1
    if len(c)>1:
        if c[-1].size<0:
            c.pop(-1)
    for s in c:
        s.size = s.size-growspeed
    for x in c:
        x.update()
    pixels = comp.complayers(c)
    client.put_pixels(pixels, channel=0)
    return
def frameStart(frame):
    global minsize,growspeed,shiftspeed,ranbowlist,flipflop,spoint
    if c[-1].size>0:
        if flipflop==len(ranbowlist):
            flipflop=0
        c.append(vox_shapes.sphere(spoint,ranbowlist[flipflop],size=.1))
        flipflop = flipflop+1
    if len(c)>1:
        if c[1].size>4:
            c.pop(0)
    for s in c:
        s.size = s.size+growspeed
    for x in c:
        x.update()
    pixels = comp.complayers(c)
    client.put_pixels(pixels, channel=0)
    return
def frameStart(frame):
    global minsize,growspeed,shiftspeed,ranbowlist,flipflop,spoint,energy,c,comp
    if c[-1].size>minsize:
        if flipflop==len(ranbowlist):
            flipflop=0
        c.append(vox_shapes.sphere(spoint,ranbowlist[flipflop],size=.1))
        flipflop = flipflop+1
    if len(c)>1:
        if c[1].size>9:
            c.pop(0)
    for s in c:
        s.size = s.size+growspeed
    for x in c:
        x.update()
    pixels = comp.complayers(c)
    client.put_pixels(pixels, channel=0)
    
    spoint = np.clip([[spoint[0][0]+random.uniform(-shiftspeed,shiftspeed)],[spoint[1][0]+random.uniform(-shiftspeed,shiftspeed)],[spoint[2][0]+random.uniform(-shiftspeed,shiftspeed)]],gd.xmin,gd.xmax)
    return
def frameStart(frame):	
    spoint = [[random.uniform(-locationbounds,locationbounds)],[random.uniform(-locationbounds,locationbounds)],[random.uniform(-locationbounds,locationbounds)]]
    if c[-1].size>minsize:
        if flipflop==len(ranbowlist):
            flipflop=0
        c.append(vox_shapes.sphere(spoint,ranbowlist[flipflop],size=.1))
        flipflop = flipflop+1
    if len(c)>1:
        if c[1].size>9:
            c.pop(0)
    for s in c:
        s.size = s.size+growspeed
    for x in c:
        x.update()
    pixels = comp.complayers(c)
    client.put_pixels(pixels, channel=0)
    
    minsize = (1-energy)*.7+.4
    growspeed = energy*.17+.03
	return
Exemple #5
0
                [.5,0.,1.],
                [1.,0.,1.],
                [1.,0.,.5]]

minsize = 1.1
growspeed = .05
shiftspeed = .1

for x in range(30):
    print ' '
    
print "Global energy level set to 1"

c=[]
comp = vox.comp()
c.append(vox_shapes.sphere([[0],[0],[0]],ranbowlist[-1],size = .1))
flipflop = 0
stime = time.time()
stage = 0
spoint = [[0],[0],[0]]
while 1:
    if c[-1].size>0:
        if flipflop==len(ranbowlist):
            flipflop=0
        c.append(vox_shapes.sphere(spoint,ranbowlist[flipflop],size=.1))
        flipflop = flipflop+1
    if len(c)>1:
        if c[1].size>4:
            c.pop(0)
    for s in c:
        s.size = s.size+growspeed
#minsize .4
#maxsize 1.1
#size range .7
#size (1-energy)*.7+.4
minsize = 1.1
#mingrow .03
#maxgrow .2
#growrange .17
#grow energy*.17+.03
growspeed = .03

locationbounds = 3

c=[]
comp = vox.comp()
c.append(vox_shapes.sphere([[0],[0],[0]],ranbowlist[-1],size = .1))
flipflop = 0


def start():
	return

def create():
	return

def exit():
	return

def frameStart(frame):	
    spoint = [[random.uniform(-locationbounds,locationbounds)],[random.uniform(-locationbounds,locationbounds)],[random.uniform(-locationbounds,locationbounds)]]
    if c[-1].size>minsize:
Exemple #7
0
else:
    # can't connect, but keep running in case the server appears later
    print '    WARNING: could not connect to %s' % IP_PORT
##****************************************##

#spawn a compositer
comp = vox.comp()
#make a red color layer
cl_red = vox_color.color([1.0,0.0,0.0])
#make an array to track layers
layer = []
#add 3 spheres to the list

#the first one will be at location x=0,y=0,z=0
#we will use the remade color layer cl_red
layer.append(vox_shapes.sphere([[0.0],[0.0],[0.0]],cl_red))

#this green sphere can be added by passing location and rgb colors 0-1.
#default size is 1 so we change it to .5.  default mode is fade chaning
#it to fill so it will not fade out around the outside
layer.append(vox_shapes.sphere([[0.0],[1.0],[0.0]],[0.0,1.0,0.0],size = .5, mode = 'fill'))

#blue layer with lowered alpha.  lower the max speed to .07 meter per frame
#the ratio that it will try to move per frame to it's target is redused
#to a fifth and it will be a bubble (faded in the middle full outside)
layer.append(vox_shapes.sphere([[0.0],[-1.0],[0.0]],[0.0,0.0,1.0], alpha = .8, maxspeed = .07, ratio = .2, mode = 'bubble'))

starttime = time.time()
while 1:
    #see how long we have been running
    changedtime = time.time()-starttime
Exemple #8
0
import math
IP_PORT = '10.0.0.10:7890'

client = opc.Client(IP_PORT)

n_pixels = 6400

##****************************************##

dis1 = 1.5
dis2 = 1.5

c=[]
comp = vox.comp()
comp.addfade(.97)
c.append(vox_shapes.sphere([[0],[0],[0]],0,size = 1))
c.append(vox_shapes.sphere([[0],[0],[0]],120,size = 1))
c.append(vox_shapes.sphere([[0],[0],[0]],240,size = 1))
stime = time.time()

def start():
	return

def create():
	return

def exit():
	return

def frameStart(frame):
    global tshift,dshift,tcolor,bcolor,c,comp,stime,dis1,dis2
Exemple #9
0
IP_PORT = '127.0.0.1:7890'

client = opc.Client(IP_PORT)
if client.can_connect():
    print '    connected to %s' % IP_PORT
else:
    # can't connect, but keep running in case the server appears later
    print '    WARNING: could not connect to %s' % IP_PORT

n_pixels = 6400



co = vox_color.color([1.0,0.0,0.0])
c = vox_shapes.sphere([[0],[0],[0]],co)
comp = vox.comp()
pixels = []
start_time = time.time()

layers = [c]
s=1.
d=1
c = vox_shapes.sphere([[0],[0],[0]],[1,0,0])
layers.append(c)
start_time = time.time()
loops = 0
while 1:
    pixels = []
    current_time = start_time - time.time()
    for l in layers:
Exemple #10
0
client = opc.Client(IP_PORT)
if client.can_connect():
    print '    connected to %s' % IP_PORT
else:
    # can't connect, but keep running in case the server appears later
    print '    WARNING: could not connect to %s' % IP_PORT
##****************************************##

#spawn a compositer
comp = vox.comp()
#make a color layer
co = vox_color.color([1.0,1.0,1.0])
#over ride the color layer with a fade
co.vfadeinit([1.0,0.0,0.0],[0.0,0.0,1.0])
#make an array to track layers and drop a fill screen layer in
layer = [vox.fillscreen(co)]
#add a sphere on top of that.  alpha = 'void' will block anything behind
#the sphere.  Should be used with full white color layer for best results
layer.append(vox_shapes.sphere([[0],[0],[0]],[1.0,1.0,1.0],alpha = 'void',mode = 'fill'))
while 1:
    for x in layer:
        #update each layer
        x.update()
    #pixels will hold the final array after the compositor if finished
    pixels = comp.complayers(layer)
    #send them to the server
    client.put_pixels(pixels, channel=0)
    #sleep (note I hate this)
    time.sleep(1/30.)
Exemple #11
0
                [1.,1.,0.],
                [.5,1.,0.],
                [0.,1.,0.],
                [0.,1.,.5],
                [0.,1.,1.],
                [0.,.5,1.],
                [0.,0.,1.],
                [.5,0.,1.],
                [1.,0.,1.],
                [1.,0.,.5]]

c=[]
comp = vox.comp()
comp.addfade(.97)
co = vox_color.color([1.0,0.0,0.0])
c.append(vox_shapes.sphere([[0],[0],[0]],ranbowlist[0],size = 1))
c.append(vox_shapes.sphere([[0],[0],[0]],ranbowlist[4],size = 1))
c.append(vox_shapes.sphere([[0],[0],[0]],ranbowlist[8],size = 1))
flipflop = 0
stime = time.time()
while 1:
    tc = time.time()-stime
    c[0].pos = np.array([[np.sin(tc+2)*1.5,np.sin(tc)*1.5,np.sin(tc)/2]])
    c[1].pos = np.array([[np.sin(tc+4)*1.5,np.sin(tc+2)*1.5,np.sin(tc+.4)/2]])
    c[2].pos = np.array([[np.sin(tc)*1.5,np.sin(tc+2)*1.5,np.sin(tc+.2)/2]])
    for x in c:
        x.update()
    pixels = comp.complayers(c)
    client.put_pixels(pixels, channel=0)
    time.sleep(1/32.)