AugmentedSolarSystem icon indicating copy to clipboard operation
AugmentedSolarSystem copied to clipboard

Enhancement - Time Warp slider / fake clock

Open johndpope opened this issue 8 years ago • 3 comments

so this class looks re-usable - by adding a uislider - they are usually added on the right hand side of screen / by sliding finger up and down - the universe would spin accordingly. https://github.com/gavineadie/Geometries/commit/b9fea346ba783f1ccfe97a4eec2d17253fa9494a


/*╔══════════════════════════════════════════════════════════════════════════════════════════════════╗
  ║ FakeClock.swift                                                                       Satellites ║
  ║ Created by Gavin Eadie on Aug26/17  ..  Copyright © 2017 Ramsay Consulting. All rights reserved. ║
  ╚══════════════════════════════════════════════════════════════════════════════════════════════════╝*/

import Foundation
import SatKit

class FakeClock {

    typealias JulianDays = Double

    static let shared = FakeClock()

    public var dateOffset: Double = 0.0
    public var dateFactor: Double = 0.0
           var dateOrigin: Date = Date()

    public func date() -> Date {

        let now = Date()
        return now + dateOffset + now.timeIntervalSince(dateOrigin) * dateFactor

    }

    public func reset() {

        self.dateOffset = 0.0
        dateFactor = 0.0
        dateOrigin = Date()

    }

    public func julianDaysNow() -> JulianDays {
        return JD.appleZero + self.date().timeIntervalSinceReferenceDate * TimeConstants.sec2day
    }

    public func ep1950DaysNow() -> Double {
        return julianDaysNow() - JD.noradZero
    }

}

      let slider = UISlider(frame: CGRectZero)
  
            slider.transform = CGAffineTransformRotate(rotateTransform, CGFloat(-90.0 * M_PI / 180.0));
            slider.addTarget(self, action: #selector(ToneCurveEditor.sliderChangeHandler(_:)), forControlEvents: .ValueChanged)
            
            addSubview(slider)


// TODO - tweak this logic. 
 func sliderChangeHandler(slider : UISlider)
    {
       FakeClock.shared.dateOffset +=  slider.value
    }

johndpope avatar Dec 03 '17 02:12 johndpope

references - https://naif.jpl.nasa.gov/naif/cosmographia.html screen shot 2017-12-04 at 11 04 47 am

johndpope avatar Dec 04 '17 16:12 johndpope

http://worldwidetelescope.org/webclient/

screen shot 2018-02-28 at 12 00 18 pm screen shot 2018-02-28 at 12 00 31 pm

johndpope avatar Feb 28 '18 17:02 johndpope

This already exists in the app

Thanks, Roderic


From: John Pope [email protected] Sent: Wednesday, February 28, 2018 9:01:25 AM To: ThumbWorks/AugmentedSolarSystem Cc: Subscribed Subject: Re: [ThumbWorks/AugmentedSolarSystem] Enhancement - Time Warp slider / fake clock (#57)

[screen shot 2018-02-28 at 12 00 18 pm]https://user-images.githubusercontent.com/289994/36801057-0aea76fa-1c7f-11e8-9564-84df24f4dc15.png

[screen shot 2018-02-28 at 12 00 31 pm]https://user-images.githubusercontent.com/289994/36801058-0af94216-1c7f-11e8-9aae-33fc8f311fbd.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ThumbWorks/AugmentedSolarSystem/issues/57#issuecomment-369307439, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAEmUiq_xOfp04EHIg92ezt_NLhvYGyhks5tZYZlgaJpZM4QzjY3.

rodericj avatar Mar 01 '18 02:03 rodericj