famo.us introduction
DESCRIPTION
Introduction to Famo.us, the Javascript framework for anyone to build performant web application on any devices.TRANSCRIPT
Famo.usJavascript Framework for any device
@allenfantasy
Famo.us is…
• A 3D layout engine can render to DOM, Canvas, WebGL • A 3D physics animation engine
A Javascript framework, including:
Famo.us is NOT…
• Backbone, Angular, Ember, … • Node.js, Koa, … • jQuery, Prototype, Mootools, …
http://disrupt.famo.us/periodic402/!!
http://famous-bird.herokuapp.com/
Why Famo.us ? • 60 FPS on ANY device • Built-in Physics Engine • Built-in event mechanism • Lightweight (179kb minimized) • Javascript ONLY, NO CSS/HTML (if u want) • Open source & Community
Build up mature, cross-device Web-App that can compete with Native App
Famo.us abstracts away DOM management by maintaining a representation called the Render Tree
HTMLCSS!
DOMjQuery!Prototype!
[pure Javascript]!…
Traditional Model
CSSFamo.us
!Render Tree
DOM
Famo.us Model
HTML
Render Tree
• Abstraction of DOM • Context Root • Renderable Basic Unit of content • Modifier Control Renderable’s • style & position
Context
ModifierRenderable
Renderable
ContextModifier
Renderable
Context
Renderable
Modifier Renderable
Renderable
• Surface <div> • ContainerSurface <div> (Can have children) • InputSurface <input> • ImageSurface <image> •…
View• Contains a set of ‘node’s. • Represent part of the page • ‘Subtree’ in Render Tree
Context
Modifier
RenderableView
Example
Vertical alignment
floater
Context
Surface!(<div>)
Modifier
Layout
Header
Footer
Content
HeaderFooterLayout GridLayout
Layout
surface 1
surface 3
Sequential Layout FlexibleLayout
1
1
3
surface 2
surface 4
Famo.us in Production
•Mobile WebApp + Wechat service for Business• 7 man-month.• Express + Famo.us + Ruby• 95% Javascript, NO HTML• Grunt + Bower + Mocha• Learning curve: 2-3 weeks for Javascript beginners
When to use ?
• SPA • when you need fancy animation •Mobile Application (esp. for web devs)
Drawbacks
•ONLY ‘View’ • ‘All or Nothing’ • Some specific device issues (e.g Android Keyboard)
Possibilities
• Famo.us + Angular (or other MV*) • Famo.us + PhoneGap / Cordova • Famo.us + Ruby (Sinatra / Padrino) •… •More on famo.us
⼲⼴广告时间
•大学城Ruby小组 / Famo.us 讨论小组 • Ruby小组订阅号 •Web实习生招聘