This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interpolate(startValue, destValue, progress, data) { | |
const r = lerp(startValue.color[0], destValue.color[0], progress); | |
const g = lerp(startValue.color[1], destValue.color[1], progress); | |
const b = lerp(startValue.color[2], destValue.color[2], progress); | |
const a = lerp(startValue.valpha, destValue.valpha, progress); | |
const color = Color.rgb(r, g, b, a)[data.format === 'rgba' ? 'rgb' : data.format](); | |
return typeof color === 'string' ? color : color.string(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initialize(startValue, destValue) { | |
return { | |
data: { | |
format: (startValue.indexOf('rgba') >= 0 && 'rgba') | |
|| (startValue.indexOf('rgb') >= 0 && 'rgb') | |
|| (startValue.indexOf('#') >= 0 && 'hex') | |
|| Color(startValue).model | |
}, | |
startValue: Color(startValue).rgb(), | |
destValue: Color(destValue).rgb() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test(startValue) { // rgb(255, 0, 0) | |
return startValue.indexOf('rgb') >= 0 | |
|| startValue.indexOf('#') >= 0 | |
|| startValue.indexOf('hsl') >= 0 | |
|| (typeof startValue === 'string' && colorString.get.rgb(startValue)); // true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = document.querySelector('#tweeningState'); | |
document.querySelector('#playPauseButton') | |
.addEventListener('click', toggle()); | |
let between = new Between(0, 400) | |
.time(2000) | |
.on('pause', () => { | |
state.innerText = 'state: paused'; | |
}).on('play', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Between('red', 'rgb(255,40,30)')... // return rgb | |
new Between('red', 'green')... // return rgb | |
new Between('hsl(57, 100%, 50%)', 'rgb(255,40,30)')... // return hsl | |
new Between('yellow', 'hsl(57, 100%, 50%)')... // return hsl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./src/between.js → ./build/between.js... | |
[!] (babel plugin) Error: [BABEL] /Users/alexko/Desktop/dk/Projects/between.js/src/x.js: Invalid Option: 'last 2 versions,safari >= 7' is not a valid value for 'targets.browser'. (While processing: "/Users/alexko/Desktop/dk/Projects/between.js/node_modules/@babel/preset-env/lib/index.js") | |
src/between.js | |
Error: [BABEL] /Users/alexko/Desktop/dk/Projects/between.js/src/x.js: Invalid Option: 'last 2 versions,safari >= 7' is not a valid value for 'targets.browser'. (While processing: "/Users/alexko/Desktop/dk/Projects/between.js/node_modules/@babel/preset-env/lib/index.js") | |
at semverifyTarget (/Users/alexko/Desktop/dk/Projects/between.js/node_modules/@babel/preset-env/lib/targets-parser.js:148:11) | |
at __default (/Users/alexko/Desktop/dk/Projects/between.js/node_modules/@babel/preset-env/lib/targets-parser.js:154:92) | |
at Object.keys.filter.sort.reduce (/Users/alexko/Desktop/dk/Projects/between.js/node_modules/@babel/preset-env/lib/targets-parser.js:195:43) | |
at A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yarn add --dev eslint prettier eslint-config-airbnb@^15.0.1 eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-import eslint-plugin-jsx-a11y@^5.1.1 | |
{ | |
"extends": ["airbnb", "prettier", "prettier/react"], | |
"plugins": ["prettier"], | |
"parser": "babel-eslint", | |
"parserOptions": { | |
"ecmaVersion": 2016, | |
"sourceType": "module", | |
"ecmaFeatures": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function elemntToTheEnd(arr, el) { | |
let counter = 0, len = arr.length; | |
for (let i = 0; i < arr.length; i++) { | |
counter++; | |
if (arr[i] == el) { | |
arr.push(arr[i]); | |
arr.splice(i, 1); | |
i--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ifDivided(arr, divider) { | |
let flag = false; | |
for (let i = 0; i < arr.length; i++) { | |
if (arr[i] % divider == 0) { | |
flag = true; | |
break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scoreWords(sentence) { | |
sentence = sentence.split(' '); | |
let amountOfLetters = 0, | |
currentCounter = 0, | |
endCounter = 0, | |
index; | |
sentence.forEach((x, i) => { | |
x.split('').forEach(y => { | |
currentCounter++ |
NewerOlder