Created
October 5, 2015 19:46
-
-
Save grantges/76c99dbb8c599caf194b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hyperloop Module | |
* Copyright (c) 2015 by Appcelerator, Inc. and subject to the | |
* Appcelerator Platform Subscription agreement. | |
*/ | |
var Hyperloop = require('hyperloop'); | |
var UIView = require('UIView'); | |
var CGRect = require('CGRect'); | |
var CGPoint = require('CGPoint'); | |
var UIColor = require('UIColor'); | |
var UIBezierPath = require('UIBezierPath'); | |
function DEGREES_TO_RADIANS(angle) { return (Number(angle) / 180.0 * Math.PI) }; | |
var IconView = Hyperloop.createClass({ | |
name: 'IconView', | |
super: 'UIView' | |
}); | |
IconView.addInstanceMethod({ | |
signature: 'drawRect:', | |
arguments: '{CGRect={CGPoint=dd}{CGSize=dd}}', | |
callback: function(_arg) { | |
var rect = new CGRect(_arg); | |
//// Color Declarations | |
var appceleratorRed = UIColor.colorWithRedGreenBlueAlpha(0.710, 0.051, 0.000, 1.000); | |
//// Bezier 2 Drawing | |
var bezier2Path = UIBezierPath.bezierPath(); | |
bezier2Path.moveToPoint(CGPoint.Make(202, 101.99)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(121.75, 155.99), CGPoint.Make(202, 131.81), CGPoint.Make(166.07, 155.99)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(81.05, 148.54), CGPoint.Make(106.89, 155.99), CGPoint.Make(92.98, 153.27)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(49.5, 162.5), CGPoint.Make(68.07, 157.05), CGPoint.Make(49.5, 162.5)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(64.15, 139.59), CGPoint.Make(49.5, 162.5), CGPoint.Make(58.95, 147.65)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(41.5, 101.99), CGPoint.Make(50.13, 129.87), CGPoint.Make(41.5, 116.61)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(68.63, 61.52), CGPoint.Make(41.5, 85.88), CGPoint.Make(51.99, 71.42)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(121.75, 48), CGPoint.Make(82.78, 53.11), CGPoint.Make(101.38, 48)); | |
bezier2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(202, 101.99), CGPoint.Make(166.07, 48), CGPoint.Make(202, 72.17)); | |
bezier2Path.closePath(); | |
appceleratorRed.setStroke(); | |
bezier2Path.lineWidth = 9; | |
bezier2Path.stroke(); | |
//// Oval 2 Drawing | |
var oval2Path = UIBezierPath.bezierPath(); | |
oval2Path.moveToPoint(CGPoint.Make(56.5, 103.5)); | |
oval2Path.addCurveToPointControlPoint1ControlPoint2(CGPoint.Make(120.5, 62.5), CGPoint.Make(56.5, 79.5), CGPoint.Make(83.79, 62.5)); | |
oval2Path.lineCapStyle = "kCGLineCapRound"; | |
appceleratorRed.setStroke() | |
oval2Path.lineWidth = 9 | |
oval2Path.stroke() | |
} | |
}); | |
var HyperloopView = UIView.extend('IconView'); | |
function Window(_navigationController) { | |
var win = Ti.UI.createWindow({ | |
backgroundColor: '#fff' | |
}); | |
var view = HyperloopView.init(); | |
view.backgroundColor = UIColor.clearColor(); | |
view.native.applyProperties({ | |
width: 300, | |
height: 300 | |
}); | |
view.layer.allowsEdgeAntialiasing = true; | |
view.layer.cornerRadius = 10; | |
win.add(view.native); | |
return win; | |
} | |
module.exports = Window; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment