Comparing version 0.1.0 to 0.1.1
/** | ||
* Forcify Demo | ||
* Forcify Example | ||
* use with <script> | ||
@@ -30,2 +30,3 @@ * | ||
// Forcify support Muti-touch! | ||
var qf2 = new Forcify(document.querySelector("#forceMe2")); | ||
@@ -32,0 +33,0 @@ qf2.on('force', function(e){ |
/** | ||
* Forcify Demo | ||
* Forcify Example | ||
* use with CommonJS | ||
@@ -10,14 +10,20 @@ * | ||
let Forcify = require('../build/forcify.js') | ||
//Require Forcify | ||
var Forcify = require('forcify') | ||
var element = document.getElementById('forceMe'); | ||
var element2 = document.getElementById('forceMe2'); | ||
var forceValueOutput = document.getElementById('forceValue'); | ||
var background = document.getElementById('background'); | ||
var touch = null; | ||
/** | ||
* Cache Element | ||
*/ | ||
var element = document.getElementById('forceMe'); | ||
var element2 = document.getElementById('forceMe2'); | ||
var forceValueOutput = document.getElementById('forceValue'); | ||
var background = document.getElementById('background'); | ||
// Hux Forcer.js | ||
/** | ||
* Create Forcify Instances | ||
*/ | ||
var qf = new Forcify(document.querySelector("#forceMe")); | ||
@@ -29,2 +35,3 @@ qf.on('force', function(e){ | ||
// Forcify support Muti-touch! | ||
var qf2 = new Forcify(document.querySelector("#forceMe2")); | ||
@@ -36,6 +43,21 @@ qf2.on('force', function(e){ | ||
/** | ||
* Render! | ||
*/ | ||
function renderElement(forceValue, _element) { | ||
_element.style.webkitTransform = 'translateX(-50%) translateY(-50%) scale(' + (1 + forceValue * 1.5) + ')'; | ||
//background.style.webkitFilter = 'blur(' + forceValue * 30 + 'px)'; | ||
// animate element | ||
_element.style.webkitTransform = | ||
'translateX(-50%) translateY(-50%) scale(' + | ||
(1 + forceValue * 1.5) + | ||
')'; | ||
// blur background, only in iOS/OSX for performance reasons. | ||
if(Forcify.detection.TOUCH3D || Forcify.detection.OSXFORCE){ | ||
background.style.webkitFilter = 'blur(' + forceValue * 30 + 'px)'; | ||
} | ||
// output force value | ||
forceValueOutput.innerHTML = 'Force: ' + forceValue.toFixed(4); | ||
} |
{ | ||
"name": "forcify-demo", | ||
"name": "forcify-example-commonjs", | ||
"version": "0.1.0", | ||
"description": "forcify demo", | ||
"description": "", | ||
"repository": { | ||
@@ -19,4 +19,4 @@ "type": "git", | ||
"dependencies": { | ||
"forcify": "^0.1.0" | ||
} | ||
} |
@@ -0,1 +1,6 @@ | ||
/** | ||
* Webpack Config for Forcify Example - use with CommonJS. | ||
* created by @huxpro | ||
*/ | ||
var webpack = require('webpack'); | ||
@@ -5,12 +10,14 @@ var path = require('path'); | ||
var nodeModulesPath = path.resolve(__dirname, 'node_modules'); | ||
var TransferWebpackPlugin = require('transfer-webpack-plugin'); | ||
var config = { | ||
//Entry points to the project | ||
entry: [ | ||
'webpack/hot/dev-server', | ||
'webpack/hot/only-dev-server', | ||
path.join(__dirname, '/3dtouch.js') | ||
path.join(__dirname, '/main.js') | ||
], | ||
//Config options on how to interpret requires imports | ||
output: { | ||
path: buildPath, //Path of output file | ||
filename: 'bundle.js' | ||
}, | ||
resolve: { | ||
@@ -20,2 +27,3 @@ extensions: ["", ".js", ".jsx"] | ||
}, | ||
//Server Configuration options | ||
@@ -25,47 +33,29 @@ devServer:{ | ||
devtool: 'eval', | ||
hot: true, //Live-reload | ||
inline: true, | ||
port: 3020 //Port Number | ||
port: 3020, //Port Number | ||
stats: { | ||
colors: true, | ||
cached: false, | ||
exclude: [/node_modules[\\\/]/] | ||
} | ||
}, | ||
devtool: 'eval', | ||
output: { | ||
path: buildPath, //Path of output file | ||
filename: 'bundle.js' | ||
}, | ||
devtool: 'source-map', | ||
plugins: [ | ||
//Enables Hot Modules Replacement | ||
new webpack.HotModuleReplacementPlugin(), | ||
//Allows error warnings but does not stop compiling. Will remove when eslint is added | ||
//new webpack.NoErrorsPlugin(), | ||
new webpack.NoErrorsPlugin(), | ||
], | ||
module: { | ||
//Loaders to interpret non-vanilla javascript code as well as most other extensions including images and text. | ||
// preLoaders: [ | ||
// { | ||
// //Eslint loader | ||
// test: /\.(js|jsx)$/, | ||
// loader: 'eslint-loader', | ||
// include: [path.resolve(__dirname, "src/app")], | ||
// exclude: [nodeModulesPath] | ||
// }, | ||
// ], | ||
loaders: [ | ||
{ | ||
//React-hot loader and | ||
test: /\.(js|jsx)$/, //All .js and .jsx files | ||
loaders: ['react-hot','babel-loader?stage=0'], //react-hot is like browser sync and babel loads jsx and es6-7 | ||
loaders: ['babel-loader?stage=0'], | ||
exclude: [nodeModulesPath] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
loaders: ["style", "css", "sass"] //"style!css!sass" | ||
} | ||
] | ||
}, | ||
//eslint config options. Part of the eslint-loader package | ||
eslint: { | ||
configFile: '.eslintrc' | ||
}, | ||
}; | ||
module.exports = config; |
{ | ||
"name": "forcify", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Hux <huxpro@gmail.com>", | ||
@@ -12,3 +12,3 @@ "description": "Forcify is a JavaScript library help you polyfill 3D/Force Touch in all devices.", | ||
], | ||
"main": "build/forcify.min.js", | ||
"main": "dist/forcify.min.js", | ||
"repository": { | ||
@@ -15,0 +15,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75838
21
692