Explore and invent new interactions
Define how designs feel
Effectively communicate concepts
Framer.js
Framer Studio
Basics
Framer started as an open source JavaScript framework, alongside a standalone importer application.
Built-in Code Editor
Instant Visual Feedback
Integrated Importing
Presentation Modes
Coffeescript
Layers, Animation, States, Events
# 赋值:
number = 42
opposite = true
# 函数:
square = (x) -> x * x
# 条件:
if happy and knowsIt
clapsHands()
haChaCha()
else
showIt()
# 数组:
list = [1, 2, 3, 4, 5]
# 对象:
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
Properties
Hierarchy
Types
# Create a layer
layerA = new Layer
x: 0
y: 0
width: 200
height: 200
backgroundColor: "#fff"
# Two ways to define hierarchy
layerB.parent = layerA
layerA.addChild(layerB)
# Place layerB on top
layerB.placeBefore(layerA)
# Image
layerA = new Layer
image: "images/sea.png"
# Video
layerA = new Layer
video: "fish.mp4"
# Text
layerA = new Layer
html: "Hello!"
Curves
Timing
Chaining
time (in seconds)
curve (ease, spring, bezier)
delay (in seconds)
repeat (amount of times)
colorModel (rgb, hsl, husl)
# Animate with an easing curve
layerA.animate
properties:
scale: 0.75
curve: "ease"
delay: 0
time: 1
layerA.animate
properties:
x: 80
curve: "ease"
layerA.onAnimationEnd ->
layerA.animate
properties:
x: 0
curve: "ease"
Properties
Add, Remove
Cycle
# The default state
layerA = new Layer
opacity: 1
# A new state titled "fade"
layerA.states.add
fade:
opacity: 0
# Switch states with animation
layerA.states.switch("fade")
# Switch states without animation
layerA.states.switchInstant("fade")
Touch, Click
Dragging
Scrolling
layerA.onTap ->
...
layerA.onScroll ->
...
layerA.onSwipe ->
...
layerA.onAnimationEnd ->
...