Skip to content

Commit

Permalink
+ New interactions: "freeze-click" and "morph-lock"
Browse files Browse the repository at this point in the history
+ New attributes: "view-box" and "speed"
+ Newly observed attributes: "path", "interaction", "speed" and "view-box"
  • Loading branch information
samuelOsborne committed Mar 7, 2021
1 parent 0435ae9 commit 5103573
Show file tree
Hide file tree
Showing 17 changed files with 6,274 additions and 49 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
![alt Lottie-interactive](https://github.com/samuelOsborne/Lottie-interactive/blob/master/lottie-interactive.png?raw=true)

# Lottie-interactive
![alt Lottie-interactive](assets/lottie-interactive.png?raw=true)

Lottie interactive is custom web element adding multiple types of interactivity to Lottie animations.

Expand Down Expand Up @@ -47,20 +45,32 @@ Plays animation when user clicks on animation container
<lottie-interactive path="button.json" interaction="click"></lottie-interactive>
```

##### freeze click
Freezes animation when user clicks on animation container
```HTML
<lottie-interactive path="button.json" interaction="freeze-click" autoplay loop></lottie-interactive>
```

##### hover
Plays animation when user hovers on animation container
```HTML
<lottie-interactive path="button.json" interaction="hover"></lottie-interactive>
```

##### morph
plays animation when user hovers on animation container, plays in reverse on 'mouseexit' event
Plays animation when user hovers on animation container, plays in reverse on 'mouseexit' event
```HTML
<lottie-interactive path="button.json" interaction="morph"></lottie-interactive>
```

##### morph-lock
Plays animation when user hovers on animation container. Locks animation at the end if user clicks. Plays in reverse on 'mouseexit' event.
```HTML
<lottie-interactive path="button.json" interaction="morph-lock"></lottie-interactive>
```

##### switch
plays animation when user clicks on animation container, plays again in reverse on second click
Plays animation when user clicks on animation container, plays again in reverse on second click
```HTML
<lottie-interactive path="button.json" interaction="switch"></lottie-interactive>
```
Expand Down
Binary file added assets/lottie-interactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/lottie-interactive.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/animations/running-pigeon.json

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions examples/freezeClick/freeze-click.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Freeze click example</title>
<script type="module" src="../../dist/lottie-interactive.js"></script>
</head>

<body>
<h1>
Interaction: 'freeze-click'
</h1>
<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
interaction="freeze-click"
autoplay
loop>
</lottie-interactive>
</div>
</body>
</html>

<style>
h1 {
text-align: center;
font-family: 'Verdana', serif;
}
</style>
3 changes: 3 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ <h1>Examples</h1>
<ul>
<li><a href="./all/all.html">All attributes</a></li>
<li><a href="./click/click.html">Interaction: Click</a></li>
<li><a href="./freezeClick/freeze-click.html">Interaction: Freeze click</a></li>
<li><a href="./hover/hover.html">Interaction: Hover</a></li>
<li><a href="./morph/morph.html">Interaction: Morph</a></li>
<li><a href="./morphLock/morph-lock.html">Interaction: Morph lock</a></li>
<li><a href="./play-on-show/play-on-show.html">Interaction: Play-on-show</a></li>
<li><a href="./play-once/play-once.html">Interaction: Play-once</a></li>
<li><a href="./switch/switch.html">Interaction: Switch</a></li>
<li><a href="./viewbox/viewbox.html">Attribute: view-box</a></li>
<li><a href="./loop/loop.html">Attribute: Loop</a></li>
<li><a href="./reset/reset.html">Attribute: Reset</a></li>
<li><a href="./autoplay/autoplay.html">Attribute: Autoplay</a></li>
Expand Down
26 changes: 26 additions & 0 deletions examples/morphLock/morph-lock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Morph lock example</title>
<script type="module" src="../../dist/lottie-interactive.js"></script>
</head>

<body>
<h1>
Interaction: 'morph-lock'
</h1>
<div style="text-align: center">
<lottie-interactive path="../animations/sun-moon.json"
interaction="morph-lock">
</lottie-interactive>
</div>
</body>
</html>

<style>
h1 {
text-align: center;
font-family: 'Verdana', serif;
}
</style>
95 changes: 95 additions & 0 deletions examples/speed/speed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Speed example</title>
<script type="module" src="../../dist/lottie-interactive.js"></script>
</head>

<body>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop>
</lottie-interactive>
</div>
<h1>
Speed: 0.1
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.5"
autoplay
loop>
</lottie-interactive>
</div>
<h1>
Speed: 0.5
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="1"
autoplay
loop>
</lottie-interactive>
</div>
<h1>
Speed: 1
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="2"
autoplay
loop>
</lottie-interactive>
</div>
<h1>
Speed: 2
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="3"
autoplay
loop>
</lottie-interactive>
</div>

<h1>
Speed: 3
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="4"
autoplay
loop>
</lottie-interactive>
</div>
<h1>
Speed: 4
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="5"
autoplay
loop>
</lottie-interactive>
<h1>
Speed: 5
</h1></div>
</body>
</html>

<style>
h1 {
text-align: center;
font-family: 'Verdana', serif;
}
</style>
90 changes: 90 additions & 0 deletions examples/viewbox/viewbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Viewbox example</title>
<script type="module" src="../../dist/lottie-interactive.js"></script>
</head>

<body>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="0 0 600 600">
</lottie-interactive>
</div>
<h1>
view-box: "0 0 600 600" (original)
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="0 0 300 300">
</lottie-interactive>
</div>
<h1>
view-box: "0 0 300 300"
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="300 300 300 300">
</lottie-interactive>
</div>
<h1>
view-box: "300 300 300 300"
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="0 300 300 300">
</lottie-interactive>
</div>
<h1>
view-box: "0 300 300 300"
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="150 150 300 300">
</lottie-interactive>
</div>
<h1>
view-box: "150 150 300 300"
</h1>

<div style="text-align: center">
<lottie-interactive path="../animations/running-pigeon.json"
speed="0.1"
autoplay
loop
view-box="-300 -300 1200 1200">
</lottie-interactive>
</div>
<h1>
view-box: "-300 -300 1200 1200"
</h1>
</body>
</html>

<style>
h1 {
text-align: center;
font-family: 'Verdana', serif;
}
</style>
Binary file removed lottie-interactive.png
Binary file not shown.
Loading

0 comments on commit 5103573

Please sign in to comment.