Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Editing the time of an existing transition
Started by DevilDev Jun 20 2018 05:43 AM

3 replies to this topic
transition editing time
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

DevilDev

[GLOBAL: userInfoPane.html]
DevilDev
  • Enthusiast

  • 49 posts
  • Corona SDK

How to edit the time of an existing transition?

local square = display.newRect( 0, 0, 100, 100 )
 
local w,h = display.contentWidth, display.contentHeight
 
local function listener1( obj )
    print( "Transition 1 completed on object: " .. tostring( obj ) )
end
  
local function listener2( obj )
    print( "Transition 2 completed on object: " .. tostring( obj ) )
end
  
transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50), onComplete=listener1 } )
  

During the transition of square ,can i change the transition time in someways?



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,744 posts
  • Corona SDK

No not really.

 

Even if you could, that would be a total hack and not guaranteed to work later.

 

Sounds like you need to write your own easing code.

 

http://robertpenner.com/easing/


  • ldurniat likes this

[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,102 posts
  • Corona Staff

I don't believe you can do this with the existing transition library,

 

Rob



[TOPIC: post.html]
#4

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,138 posts
  • Enterprise

During the transition of square ,can i change the transition time in someways?

 

recommended order:

 

1) anything a transition can do, an enterFrame listener can do... better. (my pref #1)

 

2) cancel the existing transition and start up a new one. (de facto pref #1)

 

3) there are stated plans to open-source the transition library, you could then modify it, but still on to-do-list

 

) the hack would look like this (entirely unsupported)

local thandle = transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50), onComplete=listener1 } )

-- halfway thru the transition make it 4 times slower
timer.performWithDelay(750, function()
	local now = system.getTimer()
	local dnow = now - thandle._timeStart
	local t = dnow / thandle._duration
	thandle._duration = thandle._duration*4
	thandle._timeStart = now - thandle._duration*t
end)




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: transition, editing, time