25
25
26
26
27
27
class Sequence (Effect ):
28
- def __init__ (self , ctr , seqfunc , speed , folds , angle = False ):
29
- super (Sequence , self ).__init__ (ctr )
28
+ def __init__ (self , ctr , seqfunc , speed , folds , angle = False , name = "" ):
29
+ super (Sequence , self ).__init__ (ctr , name )
30
30
self .seqfunc = seqfunc
31
31
if not ctr .layout_bounds :
32
32
ctr .fetch_layout ()
@@ -78,8 +78,8 @@ def getnext(self):
78
78
79
79
80
80
class ColorSequence (Sequence ):
81
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False ):
82
- super (ColorSequence , self ).__init__ (ctr , self .getcolor , speed , folds , angle )
81
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False , name = "ColorSequence" ):
82
+ super (ColorSequence , self ).__init__ (ctr , self .getcolor , speed , folds , angle , name = name )
83
83
if lens is False :
84
84
self .lims = [(i + 1 ) / len (cols ) for i in range (len (cols ))]
85
85
else :
@@ -102,8 +102,8 @@ def getcolor(self, x):
102
102
103
103
104
104
class GradientSequence (Sequence ):
105
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = 0 ):
106
- super (GradientSequence , self ).__init__ (ctr , self .getcolor , speed , folds , angle )
105
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = 0 , name = "GradientSequence" ):
106
+ super (GradientSequence , self ).__init__ (ctr , self .getcolor , speed , folds , angle , name = name )
107
107
if lens is False :
108
108
self .lims = [float (i ) / len (cols ) for i in range (len (cols ) + 1 )]
109
109
else :
@@ -132,9 +132,38 @@ def getcolor(self, x):
132
132
)
133
133
134
134
135
+ class HorizontalBandsCP (ColorSequence ):
136
+ def __init__ (self , ctr , cols , name = "HorizontalBands" ):
137
+ colsrgb = list (map (lambda hsl : hsl_color (* hsl ), cols ))
138
+ folds = 1.4 / (len (cols )** 0.5 )
139
+ speed = 1.0 / (10 * len (cols )** 0.5 )
140
+ super (HorizontalBandsCP , self ).__init__ (
141
+ ctr , colsrgb , speed = speed , folds = folds , angle = 0 , name = name
142
+ )
143
+
144
+
145
+ class HorizontalWavesCP (GradientSequence ):
146
+ def __init__ (self , ctr , cols , name = "HorizontalWaves" ):
147
+ colsrgb = list (map (lambda hsl : hsl_color (* hsl ), cols ))
148
+ folds = 0.7 / (len (cols )** 0.5 )
149
+ speed = 1.0 / (10 * len (cols )** 0.5 )
150
+ super (HorizontalWavesCP , self ).__init__ (
151
+ ctr , colsrgb , speed = speed , folds = folds , angle = 0 , name = name
152
+ )
153
+
154
+
155
+ class TimeSequenceCP (GradientSequence ):
156
+ def __init__ (self , ctr , cols , name = "TimeSequence" ):
157
+ colsrgb = list (map (lambda hsl : hsl_color (* hsl ), cols ))
158
+ speed = 1.0 / (14 * len (cols )** 0.5 )
159
+ super (TimeSequenceCP , self ).__init__ (
160
+ ctr , colsrgb , speed = speed , folds = 0.0 , angle = 0 , name = name
161
+ )
162
+
163
+
135
164
class SpectrumSequence (Sequence ):
136
- def __init__ (self , ctr , lightness = 0.0 , angle = False ):
137
- super (SpectrumSequence , self ).__init__ (ctr , self .getcolor , 0.2 , 1.0 , angle )
165
+ def __init__ (self , ctr , lightness = 0.0 , angle = False , name = "SpectrumSequence" ):
166
+ super (SpectrumSequence , self ).__init__ (ctr , self .getcolor , 0.2 , 1.0 , angle , name = name )
138
167
self .lightness = lightness
139
168
140
169
def getcolor (self , x ):
@@ -171,14 +200,14 @@ def update(self, step):
171
200
172
201
173
202
class RotatingAngleColorSequence (ColorSequence , RotatingAngleSequence ):
174
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False , torque = False ):
175
- super (RotatingAngleColorSequence , self ).__init__ (ctr , cols , speed = speed , folds = folds , angle = angle )
203
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False , torque = False , name = "RotatingAngleColorSequence" ):
204
+ super (RotatingAngleColorSequence , self ).__init__ (ctr , cols , speed = speed , folds = folds , angle = angle , name = name )
176
205
self .initialize (torque )
177
206
178
207
179
208
class RotatingAngleGradientSequence (GradientSequence , RotatingAngleSequence ):
180
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False , torque = False ):
181
- super (RotatingAngleGradientSequence , self ).__init__ (ctr , cols , speed = speed , folds = folds , angle = angle )
209
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 1.0 , angle = False , torque = False , name = "RotatingAngleGradientSequence" ):
210
+ super (RotatingAngleGradientSequence , self ).__init__ (ctr , cols , speed = speed , folds = folds , angle = angle , name = name )
182
211
self .initialize (torque )
183
212
184
213
@@ -207,20 +236,20 @@ def update(self, step):
207
236
208
237
209
238
class VaryingAngleColorSequence (ColorSequence , VaryingAngleSequence ):
210
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 3.0 ):
211
- super (VaryingAngleColorSequence , self ).__init__ (ctr , cols , speed , folds )
239
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 3.0 , name = "VaryingAngleColorSequence" ):
240
+ super (VaryingAngleColorSequence , self ).__init__ (ctr , cols , speed , folds , name = name )
212
241
self .initialize (folds )
213
242
214
243
215
244
class VaryingAngleGradientSequence (GradientSequence , VaryingAngleSequence ):
216
- def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 3.0 ):
217
- super (VaryingAngleGradientSequence , self ).__init__ (ctr , cols , speed , folds )
245
+ def __init__ (self , ctr , cols , lens = False , speed = 1.0 , folds = 3.0 , name = "VaryingAngleGradientSequence" ):
246
+ super (VaryingAngleGradientSequence , self ).__init__ (ctr , cols , speed , folds , name = name )
218
247
self .initialize (folds )
219
248
220
249
221
250
class MeanderingSequence (VaryingAngleSequence ):
222
- def __init__ (self , ctr , fixangle = False ):
223
- super (MeanderingSequence , self ).__init__ (ctr , self .getcolor , 0.0 , 1.0 , fixangle )
251
+ def __init__ (self , ctr , fixangle = False , name = "MeanderingSequence" ):
252
+ super (MeanderingSequence , self ).__init__ (ctr , self .getcolor , 0.0 , 1.0 , fixangle , name = name )
224
253
self .fixangle = fixangle
225
254
self .initialize (1.0 )
226
255
self .cm = ColorMeander ("sphere" )
@@ -250,8 +279,8 @@ def getcolor(self, x):
250
279
251
280
252
281
class MeanderingTandemSequence (VaryingAngleSequence ):
253
- def __init__ (self , ctr , gap = False , fixangle = False ):
254
- super (MeanderingTandemSequence , self ).__init__ (ctr , self .getcolor , 0.0 , 1.0 , fixangle )
282
+ def __init__ (self , ctr , gap = False , fixangle = False , name = "MeanderingTandemSequence" ):
283
+ super (MeanderingTandemSequence , self ).__init__ (ctr , self .getcolor , 0.0 , 1.0 , fixangle , name = name )
255
284
self .initialize (1.0 )
256
285
self .gap = gap
257
286
self .fixangle = fixangle
0 commit comments