Giter Site home page Giter Site logo

colinmeinke / wilderness Goto Github PK

View Code? Open in Web Editor NEW
154.0 10.0 8.0 447 KB

An SVG animation API

Home Page: https://wilderness.now.sh

License: MIT License

JavaScript 92.66% HTML 7.34%
svg animation javascript shapes morph tween timeline wilderness

wilderness's Introduction

Wilderness

An SVG animation API ยท https://wilderness.now.sh

gzip size test coverage travisci npm version

Summary

  • ๐ŸŽ‰ Small file size (15.1kb minified + gzip)
  • ๐ŸŒŸ Simple, functional API
  • ๐Ÿฃ Morph from anything, to anything
  • โฑ๏ธ Queue multiple animations on a timeline
  • ๐Ÿš€ Powerful playback control

Hello world

import { shape, render, timeline, play } from 'wilderness'

const morph = shape(
  { el: document.querySelector('circle') },
  { el: document.querySelector('rect') },
)

const animation = timeline(morph, {
  iterations: Infinity,
  alternate: true
})

render(document.querySelector('svg'), animation)

play(animation)

Learn Wilderness ยท View examples

wilderness's People

Contributors

colinmeinke avatar npmcdn-to-unpkg-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wilderness's Issues

Add auto option to moveIndex

Hi @colinmeinke. My last thing to ask, how to there get closest point for both start and end shape?
Like some shapes need moveIndex: 22. I want to do it auto for users.
Like D3js closest point or KUTE.js Morph Utility. Can you give me some instruction or link/guide/tutorial for this?
Thanks. Soon you see new Wilderness.js like other Morphing but for IE9+, Chrome 35+, FF30+, Opera 12.5+, even bit older browser

Tween unit values

5px is a string, so changing stroke-width from 1px to 5px will not tween.

[BUG] "Group" SVG Elements issue

Hi.
When you see SVG-Morpheus, they can morph Group elements when group shapes is different. But when i do with Wilderness, it not tweens, fail.
How i can fix it?

Thanks for amazing library and super-secured code ๐Ÿ˜„

Remove shape inheritance

Currently when creating a shape, additional plain shape objects will inherit properties from the initial plain shape object:

const from = {
  type: 'circle',
  r: 10,
  cx: 50,
  cy: 50,
  fill: '#E54',
  moveIndex: 2,
  reverse: true,
};

const to = {
  r: 20,
};

shape( from, to );

The to shape in the above example will inherit every from property apart from r. Currently to avoid this behaviour the to plain shape object should redefine the undesired properties with the default value. e.g. reverse: false.

Currently I'm planning to abandon inheritance altogether and suggest plain Javascript if inheritance is required.

const sharedProperties = {
  type: 'circle',
  cx: 50,
  cy: 50,
  fill: '#E54',
};

const from = {
  ...sharedProperties,
  r: 10,
  moveIndex: 2,
  reverse: true,
};

const to = {
  ...sharedProperties,
  r: 20,
};

shape( from, to );

Line distorted

{
  type: 'path',
  d: 'M2 2.078S4.987 4.73 11 4.73s9-2.652 9-2.652',
  strokeWidth: 2,
  strokeLinecap: 'square',
}

Allow motion path to take rotate offset

Currently rotate is boolean, and if true will rotate the shape to the angle of the current position on the motion path. rotate should also be able to take a number which will adjust the current position angle by the given value.

Can we improve algorithm for morphing?

Hi, i'm very interested in your algorithm as best i know, but some smallest bug i match. Unim.js (my old animation engine, now deprecated) uses SnapSVG algorithm.

Can we improve by mixing both algorithm? Or it's as have we leave?
Thanks for amazing library.

Demo here to see: http://codepen.io/dalisoft/pen/rrPjEd [go-to scroll bottom]

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.