Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Animation prototyping
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
yoshiki miura
November 26, 2014
Technology
1.9k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Animation prototyping
potatotips #11
yoshiki miura
November 26, 2014
Other Decks in Technology
See All in Technology
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
180
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
280
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
770
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
今さら理解するウェブフォントver.2026
takanorip
3
770
会社説明資料
persolserverworks
0
9.8k
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
510
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
150
Browser Spec: Testing Hotwire with Ruby
takahashim
1
120
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
200
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Odyssey Design
rkendrick25
PRO
2
870
The World Runs on Bad Software
bkeepers
PRO
72
12k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
550
Accessibility Awareness
sabderemane
1
250
Site-Speed That Sticks
csswizardry
13
1.6k
The Curse of the Amulet
leimatthew05
3
16k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Transcript
Animation prototyping potatotips #11
@yskm_ Profile • ࡾӜ ܚथ (yoshiki miura) • Cookpad Inc.
(20149݄~) • ϞόΠϧϑΝʔετࣨॴଐ • iOSΞϓϦ։ൃ • Pie
εΫϩʔϧϏϡʔͷ Ҿ͖Լ͛Ξχϝʔγϣϯͷϓϩτ࡞ with playground
None
PlaygroundͰΞΠίϯΛࢼ࡞
http://techlife.cookpad.com/entry/2014/11/12/170041
// όοξͷഎܠΛඳը͢Δ let rect = CGRectMake(0, 0, 96, 36) let
roundCorner = UIRectCorner.TopLeft | UIRectCorner.BottomRight let roundSize = CGSizeMake(6.0, 6.0) let path = UIBezierPath(roundedRect: rect, byRoundingCorners: roundCorner, cornerRadii: roundSize) UIColor(red: 0.35, green: 0.78, blue:1.0, alpha: 1.0).setFill() path.fill() ! // จࣈΛඳը͢Δ let attrString = NSAttributedString( string: "͓͢͢Ί", attributes:[NSForegroundColorAttributeName: UIColor.whiteColor(), NSFontAttributeName: UIFont.boldSystemFontOfSize(20.0)]) attrString.drawAtPoint(CGPointMake(6, 4))
None
var degree:CGFloat = 360.0 // <- ԁप (360.0) degree -=
90.0 var radian:CGFloat = ((degree) / 180.0 * CGFloat(M_PI)) var path = UIBezierPath() path.lineCapStyle = kCGLineCapRound path.moveToPoint(CGPoint(x: 0, y: 0)) //<- ઢͷ͞ path.addLineToPoint(CGPoint(x: 0, y: 10)) path.addArcWithCenter(CGPointMake(0, 16), radius: 7, startAngle: CGFloat(-M_PI_2), endAngle: CGFloat(radian), clockwise: true) //<- ԁͷେ͖͞ UIBezierPathͷ࡞
var angle = 0.75 var shapeLayer = CAShapeLayer() shapeLayer.path =
path.CGPath shapeLayer.lineWidth = 2.0 shapeLayer.strokeColor = UIColor.blackColor().CGColor shapeLayer.fillColor = UIColor.clearColor().CGColor shapeLayer.bounds = CGPathGetBoundingBox(path.CGPath) shapeLayer.anchorPoint = CGPointMake(0.5, 0.7) shapeLayer.position = CGPointMake(100, 100) var transform = shapeLayer.transform shapeLayer.transform = CATransform3DRotate(transform, CGFloat(M_PI*angle), 0, 0, 1.0) ! canvas.layer.addSublayer(shapeLayer) CAShapeLayerͷ࡞
ϓϩύςΟΛௐ͢Δ
ϓϩδΣΫτϑΝΠϧʹҠ২ͯ͠ εΫϩʔϧϏϡʔͱ࿈ಈͤ͞Δ
Storyboard
ViewController.swift func scrollViewDidScroll(scrollView: UIScrollView) { var value = scrollView.contentOffset.y if(value
<= 0 && value >= -50) { iconView.update(-value * 2)ɹ //※ΞΠίϯΛΞοϓσʔτ } else if(value <= -50) { iconView.update(100) } else if(value > 0) { iconView.update(0) } if (value < -50) { if(!isSearch) { UIView.animateWithDuration(0.3, animations: { self.searchBarView.alpha = 1.0 } ) isSearch = true } } else { if(isSearch) { UIView.animateWithDuration(0.3, animations: { self.searchBarView.alpha = 0.0 } ) isSearch = false } } } }
SearchIconView.swift func setup() { shapeLayer = CAShapeLayer() shapeLayer.path = self.drawPath(0.0).CGPath
shapeLayer.lineWidth = 2.0 shapeLayer.strokeColor = UIColor(white: 0.5, alpha: 1.0).CGColor shapeLayer.fillColor = UIColor.clearColor().CGColor shapeLayer.bounds = CGPathGetBoundingBox(self.drawPath(370.0).CGPath) shapeLayer.anchorPoint = CGPointMake(0.5, 0.7) shapeLayer.position = CGPointMake(25, 12) var transform = shapeLayer.transform shapeLayer.transform = CATransform3DRotate(transform, CGFloat(M_PI)*angle, 0, 0, 1.0) self.layer.addSublayer(shapeLayer) }
func drawPath(degree: CGFloat) -> UIBezierPath { var dy:CGFloat = 0.0
var d:CGFloat = degree if(degree < 360.0) { dy = 0.0 d -= 90.0 } else { dy = (degree-360)*0.5 d = 270.0 } var radian:CGFloat = (d) / 180.0 * CGFloat(M_PI) var path = UIBezierPath() path.lineCapStyle = kCGLineCapRound path.addArcWithCenter(CGPointMake(0, 16), radius: 7, startAngle: CGFloat(-M_PI_2), endAngle: radian, clockwise: true) if(degree > 360.0) { path.moveToPoint(CGPoint(x: 0, y: 10)) path.addLineToPoint(CGPoint(x: 0, y: 10-dy)) } return path }
func update(value:CGFloat) { var degree:CGFloat = value * 3.7 shapeLayer.path
= self.drawPath(degree).CGPath angle = value * 0.0075 var transform = CATransform3DIdentity CATransaction.begin() CATransaction.setAnimationDuration(0) shapeLayer.transform = CATransform3DRotate(transform, CGFloat(M_PI)*angle, 0, 0, 1.0) var py = value * 0.12 shapeLayer.position = CGPointMake(25, 12+py) CATransaction.commit() }
Finish!
Thank you for your attention.