Skip to content

Commit

Permalink
Added color property.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayuris1 committed Feb 12, 2022
1 parent 49ad821 commit 04ece3c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.internal
/build
.DS_Store
Thumbs.db
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,10 @@ _PARAMETERS_
Updates size of the curve.

_PARAMETERS_
* __size__ <kbd>float</kbd> - New size.
* __size__ <kbd>float</kbd> - New size.

#### set_color
Updates color of the curve.

_PARAMETERS_
* __color__ <kbd>vec4</kbd> - New color.
Binary file modified bezier/assets/images/bezier_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions bezier/assets/materials/bezier.material
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ fragment_constants {
name: "tint"
type: CONSTANT_TYPE_USER
value {
x: 1.0
y: 1.0
z: 1.0
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
Expand Down
8 changes: 8 additions & 0 deletions bezier/bezier.script
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ function init(self)
-- Curve thickness
go.property("size", 3.0)
go.set("#model", "size.x", self.size)

-- Color
go.property("color", vmath.vector4(0, 0, 0, 1))
go.set("#model", "tint", self.color)
end

function on_message(self, message_id, message)
Expand Down Expand Up @@ -120,5 +124,9 @@ function on_message(self, message_id, message)
elseif message_id == hash("set_size") then
self.size = message.size
go.set("#model", "size.x", self.size)

elseif message_id == hash("set_color") then
self.color = message.color
go.set("#model", "tint", self.color)
end
end

0 comments on commit 04ece3c

Please sign in to comment.