Difference between revisions of "GTween.nextTween"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2010-2011<br/> '''Class:''' GTween<br/> === Description === Simple sequenced tweens. <syntaxhighlight lang="lua"> GTween.nextTwee...")
 
(No difference)

Latest revision as of 07:20, 8 December 2025

Available since: Gideros 2010-2011
Class: GTween

Description

Simple sequenced tweens.

GTween.nextTween = GTween.new(target,duration,values,props)

Example

require "easing"

application:setBackgroundColor(0x626262)

local x, y = 8*32, 8*32
local pixel = Pixel.new(math.random(0xffffff), 1, 32, 32)
pixel:setAnchorPoint(0.5, 0.5)
pixel:setPosition(x, y)
stage:addChild(pixel)

--function GTween:init(target, duration, values, props)
local tween = GTween.new(
	pixel, 1,
	{ x=x, y=y-4*32, alpha=1.7, scaleY=2.5, },
	{ delay=4, ease=easing.outBack, repeatCount=1, dispatchEvents=true, }
)
tween.nextTween = GTween.new(
	pixel, 0.7,
	{ y=y, alpha=1, scaleY=1, },
	{ ease=easing.outBounce, repeatCount=1, }
)

tween:addEventListener("change", function()
	print("change!", tween:getPosition())
end)

tween:addEventListener("complete", function()
--	tween:toEnd() -- toBeginning(), toEnd()
--	tween:setPosition(0.75)
	print("tweened!")
end)