Coder Social home page Coder Social logo

analogclock's People

Contributors

boominadhapm avatar boominadhaprakash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

analogclock's Issues

updated for swift 5

To make this run correctly in swift 5 I just needed to make 2 changes. I got the hour, minute and second components using Calendar and removed shown commented out below. Next I commented out the +180 for LayerAnimation

//[1]
// *** Get Individual components from date ***
static let hour = Calendar.current.component(.hour, from: Date())
static let minute = Calendar.current.component(.minute, from: Date())
static let second = Calendar.current.component(.second, from: Date())

// let hour1 = CGFloat(hour * (30))//360/12 =30
// let hour2 = CGFloat(minutes)//1/60360/12 = 1/6030=0.5
// static let hour = hour1 + hour2
// //static let hour = (CGFloat(Date().hour * (360/12)) + (CGFloat(Date().minute) * (1.0/60) * (360/12)))
// static let minute = CGFloat(minutes * (360/60))
// static let second = CGFloat(seconds * (360/60))

//[2]
extension AnalogClockView {
func secondLayerAnimation() {
let secondAnimation = setUpLayerAnimation(duration: 60, isRemovedOnCompletion: false, timingFunction: CAMediaTimingFunction(name: .linear), fromValue: CGFloat(Angle.second/+180/) * CGFloat(Double.pi / 180), byValue: (2 * Double.pi))
secondLayer.add(secondAnimation, forKey: AnimationKey.second)
}
func minuteLayerAnimation() {
let minuteAnimation = setUpLayerAnimation(duration: 6060, isRemovedOnCompletion: false, timingFunction: CAMediaTimingFunction(name: .linear), fromValue: (Double(Angle.minute/+180*/) * Double.pi / 180), byValue: 2 * Double.pi)
minuteLayer.add(minuteAnimation, forKey: AnimationKey.minute)
}
func hourLayerAnimation() {
let hourAnimation = setUpLayerAnimation(duration: 606012, isRemovedOnCompletion: false, timingFunction: CAMediaTimingFunction(name: .linear), fromValue: (Double(Angle.hour/+180/) * Double.pi / 180), byValue: 2 * Double.pi)
hourLayer.add(hourAnimation, forKey: AnimationKey.hour)
}
}

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.