Skip to content

Commit

Permalink
added instructions for CodePen
Browse files Browse the repository at this point in the history
  • Loading branch information
leofavre committed Jul 25, 2017
1 parent d2026f9 commit 902bb93
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// Phrase data
/**************************************************
* *
* Gotta Light? *
* *
* -> click to control animation with the mouse. *
* -> click again for automatic animation. *
* *
* http://leofavre.com *
* https://github.com/leofavre/gotta-light *
* *
**************************************************/





const gottaLight = [
" 111 111 111 11111 ",
Expand All @@ -19,8 +33,6 @@ const gottaLight = [
" 111111 111111 "
];

// Redux initial state

const processPhraseSource = arr =>
arr.map(str => Array.from(str).map(value => parseInt(value) || 0));

Expand All @@ -47,8 +59,6 @@ const initialState = {
}
};

// Redux action names

const TOGGLE_ANIMATION_BEHAVIOUR = "TOGGLE_ANIMATION_BEHAVIOUR";
const RESIZE_CANVAS = "RESIZE_CANVAS";
const UPDATE_LIGHT_COORD = "UPDATE_LIGHT_COORD";
Expand All @@ -58,8 +68,6 @@ const UPDATE_PHRASE_SOURCE = "UPDATE_PHRASE_SOURCE";
const UPDATE_RAY_APERTURE = "UPDATE_RAY_APERTURE";
const UPDATE_RAY_REACH = "UPDATE_RAY_REACH";

// Redux action creators

const toggleAnimationBehaviour = () => ({
type: TOGGLE_ANIMATION_BEHAVIOUR
});
Expand Down Expand Up @@ -100,8 +108,6 @@ const updateRayReach = reach => ({
reach
});

// Redux reducers and store

const updatePropsToAction = (state, action, ...props) => {
let newProps = props.map(name => ({
[name]: action[name]
Expand Down Expand Up @@ -179,8 +185,6 @@ const app = Redux.combineReducers({

const store = Redux.createStore(app, initialState);

// Helpers

const degToRad = angle => angle * (Math.PI / 180);

const radToDeg = angle => angle * (180 / Math.PI);
Expand Down Expand Up @@ -225,8 +229,6 @@ const pendularEasing = num => {
return 0.5 + (Math.cos(degToRad(num % 360)) / 2);
};

// Ray

const Ray = (function() {
const render = (context, lightReach, lightCoord, rayReach, rayCoord, rayAperture) => {
let arcDefinition = _calculateArc(lightReach, lightCoord, rayReach, rayCoord, rayAperture),
Expand Down Expand Up @@ -279,8 +281,6 @@ const Ray = (function() {
};
})();

// Phrase

const Phrase = (function() {
const visibleCoords = (canvas, source, gap) => {
let [xStart, yStart] = _calculateInitialCoord(canvas, source, gap);
Expand Down Expand Up @@ -326,8 +326,6 @@ const Phrase = (function() {
};
})();

// Light

const Light = (function() {
let animationFrame,
xIncrement = 0,
Expand Down Expand Up @@ -403,8 +401,6 @@ const Light = (function() {
};
})();

// Canvas

const Canvas = (function() {
const render = (parentElement) => {
parentElement.innerHTML = `<canvas></canvas>`;
Expand Down Expand Up @@ -441,8 +437,6 @@ const Canvas = (function() {
};
})();

// UserInterface

const UserInterface = (function() {
const update = (bindings) => {
bindings.forEach(binding =>
Expand Down Expand Up @@ -472,8 +466,6 @@ const UserInterface = (function() {
};
})();

// App

const parentElement = document.getElementById("root"),
lightElement = document.getElementById("light"),
phraseGapInput = document.getElementById("phrase-gap-input"),
Expand Down

0 comments on commit 902bb93

Please sign in to comment.