Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iOS): enable dampingRatio and springVelocity #10564

Merged
merged 22 commits into from Apr 22, 2019

Conversation

Brianggalvez
Copy link
Contributor

@Brianggalvez Brianggalvez commented Jan 2, 2019

JIRA: https://jira.appcelerator.org/browse/TIMOB-18421

added dampingRatio and springVelocity to allow iOS spring animations

example :

var win = Ti.UI.createWindow({
	backgroundColor: '#fff'
})

var btn = Ti.UI.createButton({
	title: 'Trigger'
})
var box = Ti.UI.createView({
	height: 200,
	width: 200,
	bottom: 30,
	backgroundColor: 'red'
})

btn.addEventListener('click', function() {
	Ti.API.info('Hello world!')
	var scaleMatrix = Ti.UI.create2DMatrix()
	scaleMatrix = scaleMatrix.scale(0.95, 0.95)
	const springAnim = Ti.UI.createAnimation({
		transform: scaleMatrix,
		duration: 400,
		dampingRatio: 0.8,
		springVelocity: 0.4,
		autoreverse: true
	})
	box.animate(springAnim)
})

win.add(btn)
win.add(box);
win.open()

@Brianggalvez Brianggalvez changed the title enable dampingRatio and springVelocity [iOS] enable dampingRatio and springVelocity Jan 2, 2019
@build build added this to the 8.0.0 milestone Jan 2, 2019
@build build requested a review from a team January 2, 2019 18:39
@build
Copy link
Contributor

build commented Jan 2, 2019

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

🚫 Tests have failed, see below for more information.
Messages
📖

💾 Here's the generated SDK zipfile.

📖

🎊 Welcome to the Titanium SDK community, Brianggalvez! Thank you so much for your PR, you're helping us make Titanium better. 🎁

📖 ❌ 86 tests have failed There are 86 tests failing and 446 skipped out of 3582 total tests.

Tests:

Classname Name Time Error
android.emulator.Titanium.UI.Layout TIMOB-23225 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #10 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #9 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #8 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #7 5.013 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #6 5.013 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #5 5.007 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #4 5.003 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #3 5.011 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #2 5.001 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout TIMOB-23372 #1 5.003 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout layoutWithSIZE_and_fixed 5.003 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout fourPins 5.424 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout twoPins 5.012 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout scrollViewWithLargeVerticalLayoutChild 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout scrollViewWithTop 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout scrollViewWithSIZE 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout unitMeasurements 5.008 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout sizeFillConflict 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout fillInVerticalLayout 5.007 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout zIndexMultiple 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout heightPrecedence 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout widthPrecedence 5 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedBottom 5.001 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedHeight 5.754 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedRight 5.006 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedCenter 5.008 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedLeft 5.006 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout undefinedWidth 5.008 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout viewError 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout viewWidth 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout viewCenter 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.Layout viewTop 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.ListView listView with Ti.UI.Android.CardView 60.012 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView .refreshControl (Basic) 60.003 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView TIMOB-24019 60 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView deleteSectionAt 60.001 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView replaceSectionAt 60 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView insertSectionAt 60.145 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView appendSection 60.001 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView Custom template 60 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView headerView 60.001 timeout of 60000ms exceeded
android.emulator.Titanium.UI.ListView section header & footer 60.001 timeout of 60000ms exceeded
android.emulator.Titanium.UI.MaskedImage mask-tint 5.001 timeout of 5000ms exceeded
android.emulator.Titanium.UI.NavigationWindow #popToRootWindow 10.003 timeout of 10000ms exceeded
android.emulator.Titanium.UI.NavigationWindow #openWindow, #closeWindow 10 timeout of 10000ms exceeded
android.emulator.Titanium.UI.NavigationWindow basic open/close navigation 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.NavigationWindow open/close should open/close the window 10 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Window .navigationWindow 10 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker Selected index persistance 10.002 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker DatePicker postlayout event 10.003 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker DatePicker maxDate 10.005 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker DatePicker minDate 10 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker change event 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker.removeRow 10.002 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker.add (PickerRow) 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker.add(multiple PickerColumn) 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker.add(PickerColumn) 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker PlainPicker 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker TimePicker 10 timeout of 10000ms exceeded
android.emulator.Titanium.UI.Picker DatePicker 10.001 timeout of 10000ms exceeded
android.emulator.Titanium.UI.ScrollableView clipViews 5.003 timeout of 5000ms exceeded
android.emulator.Titanium.UI.ScrollView Ti.UI.SIZE 20.001 timeout of 20000ms exceeded
android.emulator.Titanium.UI.TabbedBar Index update - before window.open() 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Labels update - before window.open() 5.003 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Index - getter read 5.001 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Index - setter change 5.004 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Index - direct change 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Labels update 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Labels from BarItemType 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabbedBar Labels from Strings 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TabGroup add Map.View to TabGroup 14.786 timeout of 10000ms exceeded
android.emulator.Titanium.UI.TableView SearchView persistence 2 timeout of 2000ms exceeded
android.emulator.Titanium.UI.TableView Add and remove headerView/footerView 5.011 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TableView insertSectionBefore 5.002 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TableView insertSectionAfter 5.009 timeout of 5000ms exceeded
android.emulator.Titanium.UI.TextArea textArea in tabGroup 7.502 timeout of 7500ms exceeded
android.emulator.Titanium.UI.TextField focus-win-open 5.001 timeout of 5000ms exceeded
android.emulator.Titanium.UI.WebView ignoreSslError 30.008 timeout of 30000ms exceeded
android.emulator.Titanium.UI.WebView sslerror 30.006 timeout of 30000ms exceeded
android.emulator.Titanium.UI.WebView should handle file URLs with spaces in path - TIMOB-18765 30.003 timeout of 30000ms exceeded
android.emulator.Titanium.UI.WebView #evalJS(string, function) - async variant 30.001 timeout of 30000ms exceeded
android.emulator.Titanium.UI.WebView .zoomLevel 10.002 timeout of 10000ms exceeded
android.emulator.Titanium.UI.WebView data 30 timeout of 30000ms exceeded
android.emulator.Titanium.UI.WebView url 30.001 timeout of 30000ms exceeded
android.emulator.Titanium.Utils #base64encode(Ti.Blob#TYPE_DATA from Ti.UI.View.toImage() async) 5.01 timeout of 5000ms exceeded

Generated by 🚫 dangerJS against 6ffb8e4

brian garcía and others added 3 commits January 2, 2019 19:41
…m_mobile into TIMOB-18421

* 'TIMOB-18421' of https://github.com/Brianggalvez/titanium_mobile:
  chore(package): update lockfile package-lock.json
  fix(package): update temp to version 0.9.0
  chore(package): update lockfile package-lock.json
  chore(package): update @seadub/danger-plugin-dependencies to version 0.1.0
  refactor(android): add TiDimension constructor taking in units explicitly
@vijaysingh-axway vijaysingh-axway modified the milestones: 8.0.0, 8.1.0 Jan 4, 2019
@vijaysingh-axway
Copy link
Contributor

@Brianggalvez Thanks for PR. Can you please fix the linting issue?

@Brianggalvez
Copy link
Contributor Author

I'm running clang-format -style=file -i ~/Documents/workspace/titanium_mobile/iphone/TitaniumKit/TitaniumKit/Sources/API/TiAnimation.m and no changes are applied, which is the correct command?

@vijaysingh-axway vijaysingh-axway changed the title [iOS] enable dampingRatio and springVelocity feat(iOS): enable dampingRatio and springVelocity Feb 5, 2019
@vijaysingh-axway
Copy link
Contributor

@Brianggalvez Ideally it should work. I have fixed the listing issue.
Every thing looks good. Can you please document these properties?
Once done we will be good to go with this PR.
Thanks again for PR!

@build build requested a review from a team February 8, 2019 10:16
@build build added the docs label Feb 8, 2019
- name: dampingRatio
summary: Damping ratio of spring. Use a value between 0 and 1. For a smoother deceleration use values closer to 1.
type: Number,
platforms: [iphone, ipad]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since: "8.1.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! thanks!

Copy link
Contributor

@vijaysingh-axway vijaysingh-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR passed.

Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed: Able to see the ampingRatio and springVelocity being applied to an animation. Tested with the test case mentioned in the description

Test Environment

iPhone 6 Sim (12.1)
APPC CLI: 7.0.10-14
Operating System Name: Mac OS Mojave
Operating System Version: 10.14.2
Node.js Version: 8.9.1
Xcode 10.1

@jquick-axway
Copy link
Contributor

jquick-axway commented Feb 15, 2019

It looks like "springVelocity" is really a scale factor, correct?

Would 0.5 run the spring animation at half-speed?
And would 2.0 run the spring animation twice as fast?

If this is true, then perhaps the property should be renamed to "springScale".

I'm asking from a portability standpoint. I'll see about writing this feature up for Android and Windows once we've settled on the design.

@Brianggalvez
Copy link
Contributor Author

Hi Joshua, just prepared a little example on what springVelocity does. It's the view initial velocity so as high it is more bouncing the view does at the end.

For Android you can find this useful: https://proandroiddev.com/spring-animation-in-android-de3d4197879b

springvelocityexample

@build
Copy link
Contributor

build commented Apr 16, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖

🎊 Welcome to the Titanium SDK community, Brianggalvez! Thank you so much for your PR, you're helping us make Titanium better. 🎁

📖

✅ All tests are passing
Nice one! All 3791 tests are passing.
(There are 465 tests skipped)

Generated by 🚫 dangerJS against 08091fb

@lokeshchdhry
Copy link
Contributor

@vijaysingh-axway , I am not able to merge because it is asking for unit test. Can you please do the appropriate.

@lokeshchdhry lokeshchdhry merged commit 400594f into tidev:master Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants