Skip to content

Commit

Permalink
Add new build process
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptex committed Apr 16, 2018
1 parent 3c744d2 commit 27561e9
Show file tree
Hide file tree
Showing 7 changed files with 4,256 additions and 525 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ or
yarn add @three11/animate-top-offset
```

or

Just download this repository and link the files located in dist folder:

```
<script src="dist/index.min.js"></script>
```

## Usage

First, `import` the module:

```
import { animateTopOffset } from '@three11/animate-top-offset';
import animateTopOffset from '@three11/animate-top-offset';
```

Then use the module:
Expand All @@ -41,27 +49,27 @@ button.addEventListener('click', event => {

The function accepts four arguments:

* `offset`
* `container`
* `speed`
* `easing`
* `offset`
* `container`
* `speed`
* `easing`

```
animateTopOffset(0, window, 2000, 'easeOutSine');
```

Default values are:

* `offset` = 0
* `container` = `window`
* `speed` = 2000
* `easing` = `'easeOutSine'`
* `offset` = 0
* `container` = `window`
* `speed` = 2000
* `easing` = `'easeOutSine'`

There are three built-in easing functions:

* `'easeOutSine'`
* `'easeInOutSine'`
* `'easeInOutQuint'`
* `'easeOutSine'`
* `'easeInOutSine'`
* `'easeInOutQuint'`

## License

Expand Down
95 changes: 93 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,95 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["animateTopOffset"] = factory();
else
root["animateTopOffset"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
value: true
});
exports.animateTopOffset = void 0;
exports.default = void 0;
var win = window;
var easingEquations = {
easeOutSine: function easeOutSine(pos) {
Expand Down Expand Up @@ -52,4 +138,9 @@ var animateTopOffset = function animateTopOffset() {
tick();
};

exports.animateTopOffset = animateTopOffset;
var _default = animateTopOffset;
exports.default = _default;

/***/ })
/******/ ])["default"];
});
1 change: 1 addition & 0 deletions dist/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{
"name": "@three11/animate-top-offset",
"version": "0.2.0",
"version": "0.3.0",
"description": "Scroll a container to a specific Y offset",
"main": "dist/index.js",
"scripts": {
"build": "babel src -d dist"
"build": "webpack"
},
"repository": {
"type": "git",
"url": "git+https://github.com/three11/animate-top-offset.git"
},
"keywords": [
"Animated",
"Scroll",
"JavaScript",
"ES2017"
],
"keywords": ["Animated", "Scroll", "JavaScript", "ES2017"],
"authors": [
{
"name": "Three 11 Ltd",
Expand All @@ -39,9 +34,13 @@
},
"homepage": "https://github.com/three11/animate-top-offset#readme",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.42",
"@babel/core": "^7.0.0-beta.42",
"@babel/preset-env": "^7.0.0-beta.42",
"@babel/preset-stage-2": "^7.0.0-beta.42"
"@babel/cli": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44",
"@babel/preset-stage-2": "^7.0.0-beta.44",
"babel-loader": "^8.0.0-beta",
"unminified-webpack-plugin": "^2.0.0",
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14"
}
}
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const requestAnimFrame = (() => {
);
})();

export const animateTopOffset = (
const animateTopOffset = (
offset = 0,
container = win,
speed = 2000,
Expand Down Expand Up @@ -56,3 +56,5 @@ export const animateTopOffset = (

tick();
};

export default animateTopOffset;
21 changes: 21 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');

module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
filename: 'index.min.js',
library: 'animateTopOffset',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: [
{
test: /\.(js)$/,
loader: 'babel-loader'
}
]
},
plugins: [new UnminifiedWebpackPlugin()]
};
Loading

0 comments on commit 27561e9

Please sign in to comment.