Giter Site home page Giter Site logo

Comments (6)

sh-khashimov avatar sh-khashimov commented on May 21, 2024 1

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.

sh-khashimov avatar sh-khashimov commented on May 21, 2024 1

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.

oenama avatar oenama commented on May 21, 2024

like in here I wanna get/print the prize ($200) on startAnimating - > finished
IMG_8753

@sh-khashimov

from swiftfortunewheel.

sh-khashimov avatar sh-khashimov commented on May 21, 2024

when you start rotation animation, you specify the finish index.
Please, read the API overview.

from swiftfortunewheel.

oenama avatar oenama commented on May 21, 2024

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.

oenama avatar oenama commented on May 21, 2024

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.

I completely missed that, Thank you for your help

from swiftfortunewheel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.