Skip to content

Commit 26f7406

Browse files
committed
v1.1.0
1 parent 8f5bed3 commit 26f7406

16 files changed

+65
-39
lines changed

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## 1.1.0
2+
3+
### Features
4+
5+
- Add **blending mode** with image and image position handling
6+
- Add **scrollDebounceThreshold** option
7+
- Add **changeDirection** method
8+
- Add **changeBlendingMode** method
9+
- Add **destroy** method (fix #34)
10+
11+
### Improvements
12+
13+
- Refactor and optimisations
14+
- Add tests
15+
- Doc addition and improvements
16+
17+
118
## 1.0.6 (from 1.0.0)
219

320
### Bug Fixes

dist/granim.js

+2-2
Large diffs are not rendered by default.

dist/granim.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html><html lang="en"><head><title>API | Granim.js</title><meta name="description" content="API for granim.js. Gradients animations in javascript."><meta charset="UTF-8"><meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"><link type="text/css" rel="stylesheet" href="assets/css/style.css"><link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,400italic,700"><link rel="icon" href="favicon.ico" type="image/x-icon"><!-- Facebook Metas--><meta property="og:url" content="http://sarcadass.github.io/granim.js"><meta property="og:type" content="website"><meta property="og:title" content="Granim.js"><meta property="og:description" content="Create fluid and interactive gradients animations with this small (&lt; 10kB) .js library"><meta property="og:image" content="http://sarcadass.github.io/granim.js/assets/img/social-image.png"><!-- Twitter Metas--><meta property="twitter:card" content="summary_large_image"><meta property="twitter:creator" content="@Sarcadass"><meta property="twitter:title" content="Granim.js"><meta property="twitter:description" content="Create fluid and interactive gradients animations with this small (&lt; 10kB) .js library"><meta property="twitter:image" content="http://sarcadass.github.io/granim.js/assets/img/social-image.png"><meta property="twitter:image:width" content="1200"><meta property="twitter:image:height" content="630"><link type="text/css" rel="stylesheet" href="assets/css/prism.css"></head><body class="api"><header class="main-header"><div class="container clearfix"><div class="bloc-logo"><canvas id="logo-canvas"></canvas><a class="logo-mask" href="index.html">Granim.js</a></div><div class="main-nav"><div class="hamburger-icon"><span></span><span></span><span></span><span></span><span></span><span></span></div><nav><ul class="clearfix"><li><a class="text" href="https://github.com/sarcadass/granim.js/releases" target="_blank" rel="external">Download</a></li><li><a class="text active" href="api.html">API</a></li><li><a class="text" href="examples.html">Examples</a></li><li><a class="github" href="https://github.com/sarcadass/granim.js" target="_blank" title="Github" rel="external"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">
1+
<!DOCTYPE html><html lang="en"><head><title>API | Granim.js</title><meta name="description" content="API for granim.js. Gradients animations in javascript."><meta charset="UTF-8"><meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"><link type="text/css" rel="stylesheet" href="assets/css/style.css"><link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,400italic,700"><link rel="icon" href="favicon.ico" type="image/x-icon"><!-- Facebook Metas--><meta property="og:url" content="http://sarcadass.github.io/granim.js"><meta property="og:type" content="website"><meta property="og:title" content="Granim.js"><meta property="og:description" content="Create fluid and interactive gradients animations with this small (&lt; 17kB) .js library"><meta property="og:image" content="http://sarcadass.github.io/granim.js/assets/img/social-image.png"><!-- Twitter Metas--><meta property="twitter:card" content="summary_large_image"><meta property="twitter:creator" content="@Sarcadass"><meta property="twitter:title" content="Granim.js"><meta property="twitter:description" content="Create fluid and interactive gradients animations with this small (&lt; 17kB) .js library"><meta property="twitter:image" content="http://sarcadass.github.io/granim.js/assets/img/social-image.png"><meta property="twitter:image:width" content="1200"><meta property="twitter:image:height" content="630"><link type="text/css" rel="stylesheet" href="assets/css/prism.css"></head><body class="api"><header class="main-header"><div class="container clearfix"><div class="bloc-logo"><canvas id="logo-canvas"></canvas><a class="logo-mask" href="index.html">Granim.js</a></div><div class="main-nav"><div class="hamburger-icon"><span></span><span></span><span></span><span></span><span></span><span></span></div><nav><ul class="clearfix"><li><a class="text" href="https://github.com/sarcadass/granim.js/releases" target="_blank" rel="external">Download</a></li><li><a class="text active" href="api.html">API</a></li><li><a class="text" href="examples.html">Examples</a></li><li><a class="github" href="https://github.com/sarcadass/granim.js" target="_blank" title="Github" rel="external"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">
22
<g>
33
<path fill-rule="evenodd" clip-rule="evenodd" fill="#221E1B" d="M12.476,0C5.587,0,0,5.586,0,12.476
44
c0,5.512,3.575,10.189,8.533,11.842c0.623,0.113,0.853-0.271,0.853-0.604c0-0.296-0.011-1.279-0.017-2.32
@@ -29,14 +29,14 @@
2929
on the <span class="snippet">options.elToSetClassOn</span> element depending on the average gradient lightness,
3030
the class will be updated during the animation.<br><strong>If you don't set a name, the class won't be set.</strong></td></tr><tr><td>elToSetClassOn</td><td>'body'</td><td>String</td><td>The element to set the dark / light class on (e.g. <span class="snippet">'#canvas-wrapper'</span>)<br><strong>Only useful if you set a <span class="snippet">name</span>.</strong></td></tr><tr><td>direction</td><td>'diagonal'</td><td>String</td><td>The orientation of the gradient, you can choose between:<ul><li><span class="snippet">'diagonal'</span></li><li><span class="snippet">'left-right'</span></li><li><span class="snippet">'top-bottom'</span></li><li><span class="snippet">'radial'</span></li></ul></td></tr><tr><td>isPausedWhenNotInView</td><td>false</td><td>Boolean</td><td>Does the animation stop when it's not in window view?<br>
3131
(Despite this parameter, the animation always pause
32-
when changing tab).</td></tr><tr><td>scrollDebounceThreshold<span class="version">v1.1.0</span></td><td>300</td><td>Int</td><td>What is the scroll <a class="link" href="https://css-tricks.com/debouncing-throttling-explained-examples/" target="_blank">debounce</a> threshold (in ms)?<br><strong>Only useful if </strong><span class="snippet">isPausedWhenNotInView</span> is set to <span class="snippet">true</span>.</td></tr><tr><td>opacity <span class="required">(required)</span></td><td>/</td><td>Array of Int</td><td>You can adapt the opacity of each color of the gradient.<br>
32+
when changing tab).</td></tr><tr><td>scrollDebounceThreshold <span class="version">v1.1.0</span></td><td>300</td><td>Int</td><td>What is the scroll <a class="link" href="https://css-tricks.com/debouncing-throttling-explained-examples/" target="_blank">debounce</a> threshold (in ms)?<br><strong>Only useful if </strong><span class="snippet">isPausedWhenNotInView</span> is set to <span class="snippet">true</span>.</td></tr><tr><td>opacity <span class="required">(required)</span></td><td>/</td><td>Array of Int</td><td>You can adapt the opacity of each color of the gradient.<br>
3333
if you have two colors <span class="snippet">[1, .5]</span>,
34-
or three <span class="snippet">[1, .5, 1]</span>...</td></tr><tr><td>stateTransitionSpeed</td><td>1000</td><td>Int</td><td>Duration of the animation when changing state.</td></tr><tr><td>defaultStateName</td><td>'default-state'</td><td>String</td><td>The name of the default state.</td></tr><tr><td>states <span class="required">(required)</span></td><td>/</td><td>Object</td><td>Object containing all the states, see more info below.</td></tr><tr><td>image<span class="version">v1.1.0</span></td><td>/</td><td>Object</td><td>Object containing image options, see more info below.</td></tr></tbody></table></div><div class="container bloc"><h2>options.states</h2><p>All the options available to customize the states and the different gradients.<br>
34+
or three <span class="snippet">[1, .5, 1]</span>...</td></tr><tr><td>stateTransitionSpeed</td><td>1000</td><td>Int</td><td>Duration of the animation when changing state.</td></tr><tr><td>defaultStateName</td><td>'default-state'</td><td>String</td><td>The name of the default state.</td></tr><tr><td>states <span class="required">(required)</span></td><td>/</td><td>Object</td><td>Object containing all the states, see more info below.</td></tr><tr><td>image <span class="version">v1.1.0</span></td><td>/</td><td>Object</td><td>Object containing image options, see more info below.</td></tr></tbody></table></div><div class="container bloc"><h2>options.states</h2><p>All the options available to customize the states and the different gradients.<br>
3535
Create a state with the name you want then add these parameters.<br>
3636
By default, the name of your first state is <span class="snippet">'default-state'</span>, you can change it with <span class="snippet">options.defaultStateName</span>.</p><table class="api-list"><thead><tr><th>Property</th><th>Default</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>gradients <span class="required">(required)</span></td><td>/</td><td>Array of Arrays</td><td>The different gradients with the different colors
3737
e.g. <span class="snippet">[ ['#FFF', '#000'],
3838
['#000', '#FFF'] ]</span>.<br>
39-
The array can contain only one gradient.</td></tr><tr><td>transitionSpeed</td><td>5000</td><td>Int</td><td>Transition duration between each gradient.</td></tr><tr><td>loop</td><td>true</td><td>Boolean</td><td>When the animation has arrived to the last gradient, does it repeat?</td></tr></tbody></table></div><div class="container bloc" id="options-image"><h2>options.image<span class="version">v1.1.0</span></h2><p>All the options available to customize the image.<br>
39+
The array can contain only one gradient.</td></tr><tr><td>transitionSpeed</td><td>5000</td><td>Int</td><td>Transition duration between each gradient.</td></tr><tr><td>loop</td><td>true</td><td>Boolean</td><td>When the animation has arrived to the last gradient, does it repeat?</td></tr></tbody></table></div><div class="container bloc" id="options-image"><h2>options.image <span class="version">v1.1.0</span></h2><p>All the options available to customize the image.<br>
4040
The blending Mode works only if you set an image and gradients.</p><table class="api-list"><thead><tr><th>Property</th><th>Default</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>source <span class="required">(required)</span></td><td>/</td><td>String</td><td>The source of your image,
4141
e.g. <span class="snippet">'img/800x200.jpg'</span>.</td></tr><tr><td>position</td><td>['center', 'center']</td><td>Array</td><td>The position of your image in the canvas, represented as an <span class="snippet">[x, y]</span> array.<br>
4242
Possible values for <span class="snippet">x</span>:<ul><li><span class="snippet">'left'</span></li><li><span class="snippet">'center'</span></li><li><span class="snippet">'right'</span></li></ul>Possible values for <span class="snippet">y</span>:<ul><li><span class="snippet">'top'</span></li><li><span class="snippet">'center'</span></li><li><span class="snippet">'bottom'</span></li></ul></td></tr><tr><td>stretchMode</td><td>/</td><td>Array</td><td>Does the image have to stretch ? This option is useful for liquid/responsive design.
@@ -149,7 +149,7 @@
149149
loop: true
150150
}
151151
}
152-
);</code></pre></div><div class="footer container bloc clearfix"><p><strong>Granim v<span>1.0.6</span></strong>, created by <a href="https://twitter.com/Sarcadass" target="_blank">Benjamin Blonde</a>.
152+
);</code></pre></div><div class="footer container bloc clearfix"><p><strong>Granim v<span>1.1.0</span></strong>, created by <a href="https://twitter.com/Sarcadass" target="_blank">Benjamin Blonde</a>.
153153
MIT license.<br>
154154
Thanks to <a href="https://twitter.com/designcouch" target="_blank">@designcouch</a>
155155
for the <a href="https://codepen.io/designcouch/pen/Atyop" target="_blank">hamburger icon</a>.

docs/assets/css/scss/header.scss

+6-3
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@
160160
left:0;
161161
border-radius: 9px 0 0 9px;
162162
}
163-
&:nth-child(1), &:nth-child(2) {
163+
&:nth-child(1),
164+
&:nth-child(2) {
164165
top: 0;
165166
}
166-
&:nth-child(3), &:nth-child(4) {
167+
&:nth-child(3),
168+
&:nth-child(4) {
167169
top: 11px;
168170
}
169-
&:nth-child(5), &:nth-child(6) {
171+
&:nth-child(5),
172+
&:nth-child(6) {
170173
top: 22px;
171174
}
172175
}

docs/assets/css/scss/main.scss

+12-9
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ h1 {
1818
h2 {
1919
font-size: 1.75em;
2020
margin-bottom: 10px;
21+
22+
.version {font-size: 12px}
2123
}
2224

25+
pre {border-radius: 4px}
26+
2327
.clearfix:after {
2428
visibility: hidden;
2529
display: block;
@@ -43,15 +47,14 @@ h2 {
4347
}
4448

4549
.version {
46-
display: inline-block;
47-
padding: 2px 5px;
48-
margin-left: 7px;
49-
border-radius: 2px;
50-
font-weight: bold;
51-
font-size: 12px;
52-
vertical-align: super;
53-
background-color: #eee;
54-
color: #444;
50+
display: inline-block;
51+
padding: 2px 5px;
52+
border-radius: 2px;
53+
font-weight: bold;
54+
font-size: 10px;
55+
vertical-align: super;
56+
background-color: #eee;
57+
color: #444;
5558
}
5659

5760
.link {

docs/assets/css/scss/pages/examples.scss

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ body.examples {
2828

2929
.sandbox-footer {
3030
position: relative;
31-
padding: 10px 20px;
32-
background-color: #f5f2f0;
31+
padding: 10px 20px;
32+
background-color: #f5f2f0;
3333
margin-top: -4px;
3434
border-radius: 0 0 4px 4px;
3535
z-index: 1;
3636

37-
span {
37+
span {
3838
font-size: 14px;
3939
font-weight: bold;
40-
}
40+
}
4141

4242
select {margin-left: 5px}
4343
}
@@ -52,12 +52,13 @@ body.examples {
5252
}
5353

5454
.canvas-image-wrapper {
55+
height: 100px;
5556
background-color: #eee;
5657
text-align: center;
5758

5859
.bloc-logo {
5960
display: inline-block;
60-
margin-top: 120px;
61+
margin-top: 25px;
6162
float: none;
6263
}
6364
}

0 commit comments

Comments
 (0)