Linear_Gradient
sangfroid.layer.Linear_Gradient(tag=None)
#
Bases: sangfroid.layer.layer.Layer
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
sangfroid.value.simple.Real
|
— |
blend_method |
sangfroid.value.blendmethod.BlendMethod
|
— |
gradient |
sangfroid.value.gradient.Gradient
|
— |
loop |
sangfroid.value.simple.Bool
|
— |
p1 |
sangfroid.value.vector.X_Y
|
— |
p2 |
sangfroid.value.vector.X_Y
|
— |
z_depth |
sangfroid.value.simple.Real
|
— |
zigzag |
sangfroid.value.simple.Bool
|
— |
Source code in sangfroid/layer/layer.py
67 68 69 70 71 72 73 | |
__call__ = find
class-attribute
instance-attribute
#
Which Layer subclass handles which type of
active = TagAttrField(bool, True)
class-attribute
instance-attribute
#
True if this layer is enabled.
children
property
#
The sub-layers of this layer.
This is a generator. If this layer is not a Group, it yields no objects.
desc = DescField()
class-attribute
instance-attribute
#
A description of this field. Can be None.
exclude_from_rendering = TagAttrField(bool, False, name='exclude_from_rendering')
class-attribute
instance-attribute
#
True if this layer should not be rendered.
tag = TagField()
class-attribute
instance-attribute
#
The BeautifulSoup tag behind this item.
type_ = TypeNameField()
class-attribute
instance-attribute
#
The name Synfig uses internally for this type of layer.
In Python, you must spell this as type_, because
type is a reserved word.
version = SynfigVersionField()
class-attribute
instance-attribute
#
The earliest version of Synfig which will interpret the value of this field correctly.
append(layer)
#
Adds a Layer to the end of a Group.
Synfig stores layers backwards, so this will result in the layer appearing in the file before all other layers of its group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer
|
typing.Self
|
the layer to add |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
if you're trying to add a layer to a layer which isn't a Group. |
Source code in sangfroid/layer/layer.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
find(*args, recursive=True, attrs=None, **kwargs)
#
Like find_all(), except that it only returns the first item.
If no items are found, it returns None.
Arguments are as for find_all().
Source code in sangfroid/layer/layer.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
find_all(*args, recursive=True, attrs=None, **kwargs)
#
Finds sub-layers with particular properties.
This can only usefully be called on Groups. On other layers, it does nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
bool | str | typing.Self | collections.abc.Callable
|
you may specify at most one positional argument. If it's True, all children will match. If it's False, no children will match. If it's a string, it will match on the "type" field. If it's the Layer class or one of its subclasses, it will match layers of that type. If it's a callable, it will be called for each child; if it returns True, the child will be returned, and otherwise it won't. |
()
|
recursive
|
bool
|
if this is False, we only search the layer's immediate children; if it's True, which is the default, we search all the layer's descendants. |
True
|
attrs
|
dict | None
|
what to search for. We match against the field with the given name. The values should be strings, except that "type" can also be the class Layer or one of its subclasses. |
None
|
You may supply extra kwargs, under the same terms as "attrs"; you may not specify the same key in both.
The format of the arguments is based on Beautiful Soup's Tag.find_all() method.
Source code in sangfroid/layer/layer.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
from_tag(tag)
classmethod
#
Constructs a layer from an XML tag.
Source code in sangfroid/layer/layer.py
336 337 338 339 340 341 342 343 344 345 | |