Coder Social home page Coder Social logo

framermodules's Introduction

FramerModules

Modules that extend Framer.js


SVG Layer

A module and corresponding Sketch plugin that make it trivial to work with SVG Paths in Framer.

Numbers animating

Install the Sketch Plugin; select any path layer and run it. This automatically copies code to your clipboard.

In Framer Studio, after installing the module and importing it, create SVGLayers like so

layer = new SVGLayer.create

Then paste in what the Sketch plugin copied, which will look something like this:

layer = new SVGLayer.create
  strokeWidth: 4
  width: 502.6700134277344
  height: 204.3515625057028
  path: '<path d="M0,204.351562 C0,204.351562 383.764204,204.390625 502.670013,0"></path>'
Animation

Use layer.animatePath() to animate a path from start to end.

line animating

Alternatively, you can pass in properties to specify the direction and animation curve/time

layer.animatePath
  curve: "ease-out"
  time: 0.33
  direction: "backward"
Utils

Use layer.pathLength to get the length of the SVG path

The bad parts

First the bad parts: animating SVGs is still a little less than ideal; it’s essentially a hack. This method, while clever, relies on changing the perspective property of the layer. While this is very rarely used, there might be some cases where modifying that property on an SVG layer breaks the out of box behavior of this module. It also uses layer states to drive the animation.

Tutorial

Head over to Medium to read Working with SVG Paths in Framer.

framermodules's People

Contributors

joshpuckett avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.