Sfoglia il codice sorgente

Added animation to the attributes

JCash 1 anno fa
parent
commit
1edb7d8afd
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      examples/material/vertexcolor/vertexcolor.script

+ 8 - 2
examples/material/vertexcolor/vertexcolor.script

@@ -21,12 +21,18 @@ function init(self)
 			go.set(url, "mycolor", vmath.vector4(x/maxx, y/maxy, 0, 1))
 		end
 	end
+
+	self.updated = false
+end
+
+function update(self, dt)
+	self.updated = true
 end
 
 function on_input(self, action_id, action)
-	if action_id == hash("touch") and action.released then
+	if action_id == hash("touch") and action.pressed and self.updated then
 		for _, url in ipairs(self.urls) do
-			-- crash: go.animate(url, "mycolor", go.PLAYBACK_ONCE_PINGPONG, vmath.vector4(0, 0, 1, 1), go.EASING_OUTELASTIC, 1)
+			go.animate(url, "mycolor", go.PLAYBACK_ONCE_PINGPONG, vmath.vector4(0, 0, 1, 1), go.EASING_LINEAR, .2)
 		end
 	end
 end