an aeEaseInOut that finishes with a bounce?
Moderators: heatherlaine, kevinmiller, robinmiller, malte
-
- VIP Livecode Opensource Backer
- Posts: 32
- Joined: Mon Jul 17, 2006 2:28 am
- Location: Motegi, Japan
an aeEaseInOut that finishes with a bounce?
Hi.
I'm using aeEaseInOut to add a nifty scroll effect to a text field. Which is working fine.
What I'd like to add now to the scroll effect is a little bounce that will happen when aeEaseInOut reaches the very top/bottom of the text field. This way, the bounce shows the user they've reached the end of the field.
Is that possible with ae?
Thanks.
--
Nicolas Cueto
I'm using aeEaseInOut to add a nifty scroll effect to a text field. Which is working fine.
What I'd like to add now to the scroll effect is a little bounce that will happen when aeEaseInOut reaches the very top/bottom of the text field. This way, the bounce shows the user they've reached the end of the field.
Is that possible with ae?
Thanks.
--
Nicolas Cueto
Re: an aeEaseInOut that finishes with a bounce?
yes. It is.
Could you post your script? I could then post the adaption needed.
Cheers,
Malte
Could you post your script? I could then post the adaption needed.
Cheers,
Malte
-
- VIP Livecode Opensource Backer
- Posts: 32
- Joined: Mon Jul 17, 2006 2:28 am
- Location: Motegi, Japan
Re: an aeEaseInOut that finishes with a bounce?
Hello Malte,
Here is the scroll-down button script. Note that I use the delay between mouseDown and mouseUp to set the amount of scroll (the longer the mouse is held, the more the field gets scrolled).
Thanks for having look, Malte.
P.S. It's late but, I just saw the photo of your newest baby. Congratulations and oh so cute!
--
Nicolas Cueto
Here is the scroll-down button script. Note that I use the delay between mouseDown and mouseUp to set the amount of scroll (the longer the mouse is held, the more the field gets scrolled).
Code: Select all
local tStartTime
local lMax,lMillisecs,tStartVal,tDuration,tExponent
on mouseDown
## Get the max val of field's vScroll.
put the vScroll of fld "awords" into tOrigVScrollVal
set the lockScreen to true
set the vScroll of fld "awords" to \
(the effective textHeight of fld "awords") * \
(the number of lines in fld "awords")
put the vScroll of fld "awords" into tVscrollMaxValue
set the vScroll of fld "awords" to tOrigVScrollVal
set the lockScreen to false
put the milliseconds into tStartTime
end mouseDown
on mouseUp
put (the milliseconds - tStartTime) into tMouseDownMill
put the cpVscrollMaxValue of fld "awords" into tVMax
put ".05,.20,.50,.75" into tVStepInc
put "200,400,600" into tReleaseVals
switch
case tMouseDownMill < item 1 of tReleaseVals
## Scroll just a little.
put trunc(item 1 of tVStepInc * tVMax) into tVStep
break
case tMouseDownMill >= item 1 of tReleaseVals and tMouseDownMill < item 2 of tReleaseVals
## Scroll quite a bit.
put trunc(item 2 of tVStepInc * tVMax) into tVStep
break
case tMouseDownMill >= item 2 of tReleaseVals and tMouseDownMill < item 3 of tReleaseVals
## Scroll quite a lot.
put trunc(item 3 of tVStepInc * tVMax) into tVStep
break
default
## Scroll like a madman!
put trunc(item 4 of tVStepInc * tVMax) into tVStep
break
end switch
put the vScroll of fld "awords" + tVStep into lMax
put the vScroll of field "awords" into tStartVal
put field "duration" into tDuration
put field "exponent" into tExponent
disable me
put the milliseconds into lMillisecs
goEase
end mouseUp
on goEase
put the milliseconds-lMillisecs into tCurrentTime
set the vScroll of fld "awords" to \
round(aeEaseInOut(tStartVal,lMax,tDuration,tCurrentTime,tExponent))
if tCurrentTime <= tDuration then
send goEase to me in 20 milliseconds
else
enable me
end if
end goEase
P.S. It's late but, I just saw the photo of your newest baby. Congratulations and oh so cute!
--
Nicolas Cueto
Re: an aeEaseInOut that finishes with a bounce?
Thanks Nicolas,
things are still rather hectic. However, here is a starter
It might make sense to start the bounce easing depending on the amount of scroll already tackled by the original ease function, not triggered by the elapsed time.
Cheers,
malte
things are still rather hectic. However, here is a starter
Code: Select all
on goEase
local tCurrentTime
put the milliseconds-lMillisecs into tCurrentTime
set the vScroll of fld "awords" to \
round(aeEaseInOut(tStartVal,lMax,tDuration,tCurrentTime,tExponent))
if tCurrentTime <= tDuration then
send "goEase" to me in 20 milliseconds
else
bounceEase the millisecs
end if
put round(aeBounceEaseIn(tStartVal,lMax,tDuration,tCurrentTime,tExponent))
end goEase
on bounceEase pStart
local tCurrentTime
put the millisecs - PStart into tCurrentTime
set the vScroll of fld "awords" to round(aebounceEaseOut(lMax-50,lMax,500,tCurrentTime,tExponent))
if tCurrentTime <= 500 then
send "bounceEase" && pStart to me in 20 milliseconds
else
enable me
end if
end bounceEase
Cheers,
malte
-
- VIP Livecode Opensource Backer
- Posts: 32
- Joined: Mon Jul 17, 2006 2:28 am
- Location: Motegi, Japan
Re: an aeEaseInOut that finishes with a bounce?
Malte,
As always, thank you for the very quick response time.
The bounce effect worked but, as you say, I'd prefer the bounce easing to depend not on time elapsed but on the scroll position.
To that end, here's my imperfect modification of your code:
No bounce, though.
I think the problem is I don't understand completely the "500,tCurrentTime" in aeBounceEaseOut. Partly because of the AE documentation, which doesn't list "aeBounceEaseOut", just the following similar function:
Anyway, I'll continue to experiment on my own, all the time hoping for an AE forum email announcing you've had time to lead me by the nose to The Perfect Solution .
Cheers.
--
Nicolas Cueto
As always, thank you for the very quick response time.
The bounce effect worked but, as you say, I'd prefer the bounce easing to depend not on time elapsed but on the scroll position.
To that end, here's my imperfect modification of your code:
Code: Select all
on goEase
put the milliseconds-lMillisecs into tCurrentTime
set the vScroll of fld "awords" to \
round(aeEaseInOut(tStartVal,lMax,tDuration,tCurrentTime,tExponent))
if the vScroll of fld "awords" >= the cpVscrollMaxValue of fld "awords" then
## Scrolled to bottom, so bounce.
bounceEase the milliseconds
exit goEase
end if
if tCurrentTime <= tDuration then
send goEase to me in 20 milliseconds
else
enable me
end if
## Malte, I don't understand this next line is yours so I commented it out...
-- put round(aeBounceEaseIn(tStartVal,lMax,tDuration,tCurrentTime,tExponent))
end goEase
on bounceEase pStart
local tCurrentTime
put the millisecs - PStart into tCurrentTime
set the vScroll of fld "awords" to \
round(aeBounceEaseOut(lMax-50,lMax,500,tCurrentTime,tExponent))
if tCurrentTime <= 500 then
send "bounceEase" && pStart to me in 20 milliseconds
else
enable me
end if
end bounceEase
I think the problem is I don't understand completely the "500,tCurrentTime" in aeBounceEaseOut. Partly because of the AE documentation, which doesn't list "aeBounceEaseOut", just the following similar function:
Note that in the code you sent me there's an exponent value that's not in the AE doc example.ae EaseBounce In(startValue,endValue,duration,elapsedTime)
get aeBounceEaseIn(10,20,1000,50,2)
get aeBounceEaseIn(10,20,1000,500,4)
Use this function to generate easeIn values. Call it in a timed script to get all values inbetween. You specify a start and an end value, the ease duration and the elapsed time.
Anyway, I'll continue to experiment on my own, all the time hoping for an AE forum email announcing you've had time to lead me by the nose to The Perfect Solution .
Cheers.
--
Nicolas Cueto
-
- VIP Livecode Opensource Backer
- Posts: 32
- Joined: Mon Jul 17, 2006 2:28 am
- Location: Motegi, Japan
Re: an aeEaseInOut that finishes with a bounce?
Found a solution on my own .
I modified the mouseUp thus:
But Malte, please still confirm whether, despite the AE documentation, aeBounceEaseIn/Out requires an exponent value.
Cheers.
--
Nicolas Cueto
I modified the mouseUp thus:
Code: Select all
put the cpVscrollMaxValue of fld "awords" into tVMax
...
put the vScroll of fld "awords" + tVStep into lMax
if lMax > tVMax then put tVMax into lMax
But Malte, please still confirm whether, despite the AE documentation, aeBounceEaseIn/Out requires an exponent value.
Cheers.
--
Nicolas Cueto