From: Ben Morrow Date: Sun, 24 Nov 2013 02:03:27 +0000 (-0800) Subject: Hackathon anims X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6a4882ddc3c9219b599940168d7d83aa931cacd9;p=SugarCubes.git Hackathon anims --- diff --git a/BenMorrow.pde b/BenMorrow.pde index 51945a8..f88e208 100644 --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -1,3 +1,111 @@ +class XYZPixel extends SCPattern +{ + float xm = model.xMin; + float ym = model.yMin; + float zm = model.zMin; + + float cubeWidth = 35; + float xm2 = model.xMin+cubeWidth; + float ym2 = model.yMin+cubeWidth; + float zm2 = model.zMin+cubeWidth; + + XYZPixel(GLucose glucose) { + super(glucose); + //myP = new LXPoint(20,20,20); + } + + void run(double deltaMs) + { + for(LXPoint p : model.points) + { + if(p.x > xm && p.x<= xm2 && p.y > ym && p.y<= xm2 && p.z<= zm2 && p.z > zm) + { + colors[p.index] = lx.hsb(lx.getBaseHue()+100, 100, 100); + + }else{ + colors[p.index] = 0; + } + } + float minIS=min(model.xMax,model.yMax,model.zMax); + xm = (xm + 1 ) % minIS; + ym = (ym + 1 ) % minIS; + zm = (zm + 1 ) % minIS; + + xm2 = xm + cubeWidth; + ym2 = ym2 + cubeWidth; + zm2 = zm2 + cubeWidth; + } +} + +class MultipleCubes extends SCPattern +{ + float xm = model.xMin; + float ym = model.yMin+10; + float zm = model.zMin+5; + + float xma = model.xMin; + float xmb = model.xMin; + + float cubeWidth = 35; + + float minIS; + + MultipleCubes(GLucose glucose) { + super(glucose); + minIS = 200; + } + + void drawVirtualCube(float bottomX, float bottomY, float bottomZ, float side, int cubeColor) + { + for(LXPoint p : model.points) + { + if(p.x > bottomX && p.x<= bottomX+side && p.y > bottomY && p.y<= bottomY + side && p.z > bottomZ && p.z<= bottomZ+side) + { + colors[p.index] = cubeColor; + } + } + } + + void clear() + { + for(int i=0;i