Comments (6)
Regardless of your pin position, if configuration.wheelPreferences.startPosition
set to .top
, your rotation animation will stop at specified finishIndex
.
if configuration.wheelPreferences.startPosition
set to .top
and your pin also on the top position, rotation always stops at the top. (at the pin position)
code from VariousWheelSimpleViewController.swift
won't work for you. self.finishIndex
is a computed property, when you call print(self.finishIndex)
, it will return a new random number.
from swiftfortunewheel.
try this:
let _finishIndex = self.finishIndex
wheelControl.startAnimating(indefiniteRotationTimeInSeconds: 1, finishIndex: _finishIndex) { (finished) in
print(finished)
if finished {
print(_finishIndex)
/// --> here
print(self.prizes[_finishIndex])
}
}
from swiftfortunewheel.
like in here I wanna get/print the prize ($200) on startAnimating - > finished
from swiftfortunewheel.
when you start rotation animation, you specify the finish index.
Please, read the API overview.
from swiftfortunewheel.
when you start rotation animation, you specify the finish index.
Please, read the API overview.
I did, but how can I add the finished index at pin image position? or like if I wanted it to be random and still need to get the prize title at pin image position
@sh-khashimov
from VariousWheelSimpleViewController.swift
var finishIndex: Int {
return Int.random(in: 0..<wheelControl.slices.count)
}
wheelControl.startAnimating(indefiniteRotationTimeInSeconds: 1, finishIndex: finishIndex) { (finished) in
print(finished)
if finished {
print(self.finishIndex)
/// --> here
print(self.prizes[self.finishIndex])
}
}
from swiftfortunewheel.
Regardless of your pin position, if
configuration.wheelPreferences.startPosition
set to.top
, your rotation animation will stop at specifiedfinishIndex
.
ifconfiguration.wheelPreferences.startPosition
set to.top
and your pin also on the top position, rotation always stops at the top. (at the pin position)code from
VariousWheelSimpleViewController.swift
won't work for you.self.finishIndex
is a computed property, when you callprint(self.finishIndex)
, it will return a new random number.
I completely missed that, Thank you for your help
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.