@@ -25,11 +25,16 @@ defmodule Scenic.Primitive.Sprites do
25
25
are executed in order when the primitive renders.
26
26
27
27
`[ {{src_x, src_y}, {src_w, src_h}, {dst_x, dst_y}, {dst_w, dst_h}} ]`
28
+ or
29
+ `[ {{src_x, src_y}, {src_w, src_h}, {dst_x, dst_y}, {dst_w, dst_h}}, alpha ]`
28
30
29
31
Each draw command is an x/y position and width/height of a rectangle in
30
32
the source image, followed by the x/y position and width/height
31
33
rectangle in the destination space.
32
34
35
+ An optional alpha channel can be set in last position to apply a transparency
36
+ effect on the sprite.
37
+
33
38
In other words, This copies rectangular images from the source
34
39
indicated by image_id and draws them in the coordinate space of
35
40
the graph.
@@ -59,14 +64,16 @@ defmodule Scenic.Primitive.Sprites do
59
64
You should add/modify primitives via the helper functions in
60
65
[`Scenic.Primitives`](Scenic.Primitives.html#sprites/3)
61
66
62
- This example draws the same source rectangle twice in different locations.
63
- The first is at full size, the second is expanded 10x.
67
+ This example draws the same source rectangle three times in different locations.
68
+ The first is at full size, the second is expanded 10x, the third is with a
69
+ 50% transparency effect.
64
70
65
71
```elixir
66
72
graph
67
73
|> sprites( { "images/my_sprites.png", [
68
74
{{0,0}, {10, 20}, {10, 10}, {10, 20}},
69
75
{{0,0}, {10, 20}, {100, 100}, {100, 200}},
76
+ {{0,0}, {10, 20}, {100, 100}, {100, 200}, 0.5}
70
77
]})
71
78
```
72
79
"""
0 commit comments