Changeset - bd1d03349b9a
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 9 years ago 2016-06-12 01:57:00
drewp@bigasterisk.com
noise(t) function for effects
Ignore-this: c8a38134f7bbda0d625326cdd1647e1f
2 files changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/effect/effecteval.py
Show inline comments
 
from __future__ import division
 
from rdflib import URIRef, Literal
 
from light9.namespaces import L9, RDF
 
from webcolors import rgb_to_hex, hex_to_rgb
 
from decimal import Decimal
 
import math
 
from noise import pnoise1
 

	
 
def literalColor(rnorm, gnorm, bnorm):
 
    return Literal(rgb_to_hex([rnorm * 255, gnorm * 255, bnorm * 255]))
 

	
 
def nsin(x): return (math.sin(x * (2 * math.pi)) + 1) / 2
 
def ncos(x): return (math.cos(x * (2 * math.pi)) + 1) / 2
 
def nsquare(t, on=.5):
 
    return (t % 1.0) < on
 
def lerp(a, b, t):
 
    return a + (b - a) * t
 
def noise(t):
 
    return pnoise1(t, 2)
 

	
 
def scale(value, strength):
 
    if isinstance(value, Literal):
 
        value = value.toPython()
 

	
 
    if isinstance(value, Decimal):
requirements.txt
Show inline comments
 
@@ -30,6 +30,7 @@ txzmq==0.7.4
 

	
 
pyusb==1.0.0
 
coverage==4.1
 
klein==15.3.1
 
git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales
 
colormath==2.1.1
 
noise==1.2.2
0 comments (0 inline, 0 general)