소스 검색

Added animation to the attributes

JCash 1 년 전
부모
커밋
1edb7d8afd
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  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