Skip to content

Commit 641e58b

Browse files
committed
adjust doc
1 parent 11cba58 commit 641e58b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/scenic/primitive/sprites.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ defmodule Scenic.Primitive.Sprites do
2525
are executed in order when the primitive renders.
2626
2727
`[ {{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 ]`
2830
2931
Each draw command is an x/y position and width/height of a rectangle in
3032
the source image, followed by the x/y position and width/height
3133
rectangle in the destination space.
3234
35+
An optional alpha channel can be set in last position to apply a transparency
36+
effect on the sprite.
37+
3338
In other words, This copies rectangular images from the source
3439
indicated by image_id and draws them in the coordinate space of
3540
the graph.
@@ -59,14 +64,16 @@ defmodule Scenic.Primitive.Sprites do
5964
You should add/modify primitives via the helper functions in
6065
[`Scenic.Primitives`](Scenic.Primitives.html#sprites/3)
6166
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.
6470
6571
```elixir
6672
graph
6773
|> sprites( { "images/my_sprites.png", [
6874
{{0,0}, {10, 20}, {10, 10}, {10, 20}},
6975
{{0,0}, {10, 20}, {100, 100}, {100, 200}},
76+
{{0,0}, {10, 20}, {100, 100}, {100, 200}, 0.5}
7077
]})
7178
```
7279
"""

0 commit comments

Comments
 (0)