|
@@ -386,3 +386,34 @@ class LerpColorScaleInterval(LerpInterval):
|
|
|
# Initialize superclass
|
|
# Initialize superclass
|
|
|
LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
|
LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+class LerpColorInterval(LerpInterval):
|
|
|
|
|
+ # Name counter
|
|
|
|
|
+ lerpColorNum = 1
|
|
|
|
|
+ # Class methods
|
|
|
|
|
+ def __init__(self, node, duration, startColor, endColor,
|
|
|
|
|
+ other=None, blendType='noBlend', name=None):
|
|
|
|
|
+
|
|
|
|
|
+ def functorFunc(node=node, startColor=startColor,
|
|
|
|
|
+ endColor=endColor, other=other):
|
|
|
|
|
+ assert(not node.isEmpty())
|
|
|
|
|
+ if callable(endColor):
|
|
|
|
|
+ # This may be a thunk that returns a point.
|
|
|
|
|
+ endColor = endColor()
|
|
|
|
|
+ if callable(startColor):
|
|
|
|
|
+ # This may be a thunk that returns a point.
|
|
|
|
|
+ startColor = startColor()
|
|
|
|
|
+ if (other != None):
|
|
|
|
|
+ functor = ColorLerpFunctor(node, startColor, endColor, other)
|
|
|
|
|
+ else:
|
|
|
|
|
+ functor = ColorLerpFunctor(node, startColor, endColor)
|
|
|
|
|
+ return functor
|
|
|
|
|
+
|
|
|
|
|
+ # Generate unique name if necessary
|
|
|
|
|
+ if (name == None):
|
|
|
|
|
+ name = 'LerpColorInterval-%d' % LerpColorInterval.lerpColorNum
|
|
|
|
|
+ LerpColorInterval.lerpColorNum += 1
|
|
|
|
|
+ # Initialize superclass
|
|
|
|
|
+ LerpInterval.__init__(self, name, duration, functorFunc, blendType)
|
|
|
|
|
+
|