Comments (6)
Unfortunately, there is no such as thing like accelerating and decelerating at any animation method.
However, you can try this solution:
extension SwiftFortuneWheel {
func animate(withAcceleration acceleration: CGFloat, accelerationTimeInSecond: Int) {
guard let animationDuration = CFTimeInterval(exactly: accelerationTimeInSecond*2) else { return }
let fullRotationsUntilFinish = Int((15*acceleration).rounded(.down))
self.startAnimating(finishIndex: 0, fullRotationsUntilFinish: fullRotationsUntilFinish, animationDuration: animationDuration, nil)
let deadline = DispatchTime.now() + DispatchTimeInterval.seconds(accelerationTimeInSecond)
DispatchQueue.main.asyncAfter(deadline: deadline) {
self.startAnimating()
}
}
}
And in your startAnimating
method:
fortuneWheel.animate(withAcceleration: 30, accelerationTimeInSecond: 4)
Try to play with variables, please let me know if it helped you.
Sorry if I don't understand you correctly. If you mean just a rotation speed, I will add this to the next release.
from swiftfortunewheel.
Ok thanks. I'll look for the rotation speed in the next release.
from swiftfortunewheel.
1.0.3 released.
from swiftfortunewheel.
@sh-khashimov How can we adjust the speed of rotation when the wheel is in indefinite speed mode?
from swiftfortunewheel.
let speed: CGFloat = 10
fortuneWheel.startContinuousRotationAnimation(with: speed)
from swiftfortunewheel.
@sh-khashimov thanks for the quick reply. Can we also adjust accelerating for the wheel? Because currently, I'm not seeing any difference if we increase or decrease the rotation speed.
from swiftfortunewheel.
Related Issues (20)
- how to find the selected slice index HOT 1
- How to show slice Text for single slice?
- Rotation animation could be sometimes frozzen HOT 1
- IB Designables issue HOT 2
- Can we apply gradient color to Slice and apply gradient color for Slice's Text? is it possible with some customization? HOT 9
- Can I use it in Objective-C project HOT 1
- can we set image (dynamic size --> fit to slice segment frame) and text in center for slice for any no. of slices in wheel? HOT 5
- Without Storyboard Issue
- positioning on slice after update HOT 2
- spinImage rotate with the wheel
- Bridge UIViewControllerRepresentable SwiftUI HOT 9
- get selected value after rotation HOT 2
- External audio stops right after fortune wheel initialization HOT 10
- Get the correct value after the wheel stopped HOT 1
- How can I get the current spinning value ?
- SwiftFortuneWheelDemo-SwiftUI SFWConfiguration example not working
- Rotate the slice image HOT 1
- Can we shrink or scale the slice text? Some of slice Word is skipped HOT 2
- The result will spin back to default, exit and enter to App on onetime.
- Cannot build on Xcode 14: Stored properties cannot be marked potentially unavailable with '@available' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftfortunewheel.