Skip to content

Instantly share code, notes, and snippets.

/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
import React, { Component } from 'react';
import {
View,
PanResponder,
Animated,
} from 'react-native';
class Draggable extends Component {
constructor(props){
//
// PathView.swift
//
// Created by Alex Gibson on 7/23/17.
// Copyright © 2017 AG. All rights reserved.
//
import UIKit
@IBDesignable
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self longAnimation];
}
@agibson73
agibson73 / CutOutBluredText
Last active June 13, 2017 20:04
Animated Text CGPath with an image background
import UIKit
import CoreMotion
@IBDesignable
class CutOutBluredText: UIView {
@IBInspectable var backgroundImage : UIImage? = nil{
didSet{
setUp()
}
//In the controllers to not rotate
override var shouldAutorotate : Bool {
return false
}
override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
//otherwise i did not change anything. and as long as all orientations are supported if you don't set above it will rotate.
// on dismiss i think it reoriented but i might have ask for layout or something cannot remember.
CATransaction.begin()
let animation = CABasicAnimation(keyPath: "position")
animation.toValue = NSValue(cgPoint: CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100))
animation.fromValue = NSValue(cgPoint: position)
animation.duration = 5
animation.isRemovedOnCompletion = false
animation.fillMode = kCAFillModeForwards
CATransaction.setCompletionBlock({
self.airplane.layer.position = CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100)
@agibson73
agibson73 / PulseTouchCollectionViewCell
Created March 12, 2017 00:30
Just a UICollectionview cell animation on touch although it could be performed on any uiview.
import UIKit
@IBDesignable class PulseTouchCollectionViewCell: UICollectionViewCell {
@IBInspectable var scaleFactor : CGFloat = 1.3
@IBInspectable var animationColor : UIColor = UIColor.green
@IBInspectable var startingOpacity : Float = 0.2
@IBInspectable var animationDuration : Double = 0.8
#import "SettingsViewController.h"
#import "HomeViewController.h"
#import "AppDelegate.h"
#import "Location+CoreDataClass.h"
#import "LocationManager.h"
#import "DarkSkyAPI.h"
@interface SettingsViewController ()<UISearchBarDelegate>
call in viewDidLoad
setUpNavBar(bottomBorderColor: .white, opacity: 0.4, height: 1)
func setUpNavBar(bottomBorderColor:UIColor,opacity:Float,height:CGFloat){
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
let navLabel = UILabel(frame: CGRect.zero)
navLabel.backgroundColor = UIColor.clear
navLabel.font = UIFont.systemFont(ofSize: 18)
navLabel.textAlignment = NSTextAlignment.center