Almost there

This commit is contained in:
Devine Lu Linvega 2017-11-05 14:52:05 +14:00
parent 6a4dae83ae
commit 6b8e08e41f
32 changed files with 580 additions and 41 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
node_modules/
builds/
*.wav
*.wav

52
BUILD.md Normal file
View File

@ -0,0 +1,52 @@
## Build
Don't forget to ```npm cache clean```!
### Build Linux64 / Darwin64 / Windows64(Offsite)
```
cd /xxiivv/Nataniev/public/public.projects/sources/Dotgrid/
git pull
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-linux-x64/
rm /xxiivv/Nataniev/public/public.projects/builds/dotgrid_lin64.zip
electron-packager . Dotgrid --platform=linux --arch=x64 --out /xxiivv/Nataniev/public/public.projects/builds --overwrite --electron-version=1.7.5 --icon=icon.ico
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-win32-x64/
rm /xxiivv/Nataniev/public/public.projects/builds/dotgrid_win64.zip
electron-packager . Dotgrid --platform=win32 --arch=x64 --out /xxiivv/Nataniev/public/public.projects/builds --overwrite --electron-version=1.7.5 --icon=icon.ico
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-darwin-x64/
rm /xxiivv/Nataniev/public/public.projects/builds/dotgrid_osx64.zip
electron-packager . Dotgrid --platform=darwin --arch=x64 --out /xxiivv/Nataniev/public/public.projects/builds --overwrite --electron-version=1.7.5 --icon=icon.icns
cd /xxiivv/Nataniev/public/public.projects/builds/
~/butler push /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-linux-x64/ hundredrabbits/dotgrid:linux-64
~/butler push /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-win32-x64/ hundredrabbits/dotgrid:windows-64
~/butler push /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-darwin-x64/ hundredrabbits/dotgrid:osx-64
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-darwin-x64/
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-linux-x64/
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-win32-x64/
~/butler status hundredrabbits/dotgrid
```
### Build Linux64 / Darwin64 / Windows64(Local)
```
cd /Users/VillaMoirai/Desktop/
rm -r /Users/VillaMoirai/Desktop/Dotgrid-darwin-x64/
rm -r /Users/VillaMoirai/Desktop/Dotgrid-linux-x64/
rm -r /Users/VillaMoirai/Desktop/Dotgrid-win32-x64/
cd /Users/VillaMoirai/Github/HundredRabbits/Dotgrid/
electron-packager . Dotgrid --platform=darwin --arch=x64 --out /Users/VillaMoirai/Desktop/ --overwrite --electron-version=1.7.5 --icon=icon.icns
cd /Users/VillaMoirai/Github/HundredRabbits/Dotgrid/
electron-packager . Dotgrid --platform=linux --arch=x64 --out /Users/VillaMoirai/Desktop/ --overwrite --electron-version=1.7.5 --icon=icon.ico
cd /Users/VillaMoirai/Github/HundredRabbits/Dotgrid/
electron-packager . Dotgrid --platform=win32 --arch=x64 --out /Users/VillaMoirai/Desktop/ --overwrite --electron-version=1.7.5 --icon=icon.ico
```

96
LICENSE.md Normal file
View File

@ -0,0 +1,96 @@
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.

BIN
PREVIEW.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

260
README.md
View File

@ -1,27 +1,251 @@
# Dotgrid
# Marabu
Minimalist vector drawing tool to create grid based SVGs. There isn't much to it at the moment. Enjoy!
Marabu is a simple open-source music tracker built from Soundbox.
## Functions
<img src='https://raw.githubusercontent.com/hundredrabbits/Marabu/master/PREVIEW.jpg' width="600"/>
## Guide
If this is your first time using a tracker, don't worry this quick introduction will cover the basics of writing a little track, and exporting it to an audio file.
The interface is divided into 3 columns, the *sequencer*, the *pattern editor* and the *instrument*. By default, the application launches with an active pattern, in the first instrument. There is a maximum of 16 instruments that can play at the same time.
To move the **pattern cursor**, use the arrow keys. Pressing the keyboard keys a,s,d,f,g,h & j will record a note in the first row of the first column. Pressing the ArrowDown and ArrowUp keys, will move the *cursor* up/down in the sequencer. Allowing you to fill `pattern #1` with notes. Pressing `space` will play the pattern, pressing `esc` will stop.
To change the **sequencer patterns**, use the arrow keys while `holding alt`. To add notes to a second instrument, move to the second column and press `alt ArrowRight`, this will set the first row of the second instrument to 1, and allow you to record notes. Press `alt ArrowDown` to move to the second row, and press `alt ArrowRight` again twice, to extend the track to 2 rows, and begin adding notes to the second row of the second instrument.
To change the **instrument controls**, use the arrow keys while `holding shift`. To save your song, press `ctrl s`, to render an audio file(.wav) press `ctrl r`.
## Controls
### Basics
- `space` Play.
- `esc` Stop.
### General
- `ctrl n` New.
- `ctrl s` Save.
- `ctrl S` Save as.
- `ctrl o` Open.
- `ctrl r` Export .wav.
- `ctrl i` Export .ins(instrument).
- `ctrl t` Export .thm(instrument).
### Sequencer
#### Arrows
- `alt ArrowDown` Next Sequence.
- `alt ArrowUp` Previous Sequence.
- `alt ArrowRight` Increment Pattern Id +1.
- `alt ArrowLeft` Decrement Pattern Id -1.
#### Keys
- `ctrl l` Loopmode, see below.
### Editor
#### Arrows
- `ArrowRight` Next Instrument.
- `ArrowLeft` Previous Instrument.
- `ArrowDown` Next Row.
- `ArrowUp` Previous Row.
#### Keys
- `)` Increment Note Value +12.
- `(` Decrement Note Value -12.
- `0` Increment Note Value +1.
- `9` Decrement Note Value -1.
- `Backspace` Erase Note in Row.
- `/` Add a Control Keyframe.
- `Tab` Toggle **Composition Mode**.
### Instrument
#### Arrows
- `shift ArrowDown` Next Control.
- `shift ArrowUp` Previous Control.
- `shift ArrowRight` Increment Control Value +1.
- `shift ArrowLeft` Decrement Control Value -1.
#### Keys
- `]` Increment Control Value +10.
- `[` Decrement Control Value -10.
- `}` Increment Control Value +1.
- `{` Decrement Control Value -1.
- `x` Next Octave.
- `z` Previous Octave.
### Keyboard
Hold `shift`, while pressing a note, to make chords.
- `a` Play/Record C.
- `s` Play/Record D.
- `d` Play/Record E.
- `f` Play/Record F.
- `g` Play/Record G.
- `h` Play/Record A.
- `j` Play/Record B.
- `w` Play/Record C#.
- `e` Play/Record D#.
- `t` Play/Record F#.
- `y` Play/Record G#.
- `u` Play/Record A#.
## Effects
### Envelope
- `ATK` Attack
- `SUS` Sustain
- `REL` Release
- `POW` Attack/Release curve
### Osc
- `MOD` --
- `MIX` Dry/Wet between the 2 osc
- `FRQ` Frequency
- `DET` Detune, frequency offset between the 2 osc.
### LFO
- `AMT` Amount
- `FRQ` Frequency
### Efx
- `LP` Low-pass
- `HP` High-pass
- `BP` Band-pass
- `FRQ` Filter Frequency
- `RES` Resonance
### Delay
- `DLY` Delay Rate
- `VOL` Delay Volume
### Shapers
- `NOI` Noise Volume
- `BIT` Bitcrusher
- `DIS` Distortion
- `PIN` Pinking
- `CMP` Compressor
- `DRV` Drive
- `PAN` Pan
### UV
- `VOL` UV Volume/Envelope
- `WAV` UV Wave shape
## Cheatmode
Press `ctrl k` to activate cheatmode. Press `esc` to exit cheatmode.
### Selection
The cheatmode will catch 3 keys, corresponding to int/hex of `rate`, `length` & `offset` of the selection. The `/` key indicates that it does not loop through the whole pattern.
- `4` Every 4th note.
- `42` Every 4th note, and the following one.
- `422` Every 4th note, and the following one, starting from the second.
- `/` Only the first note.
- `/ 44` Only the 5th, 6th, 7th and 8th first notes.
### Copy/Paste
- `c` To copy the entire pattern.
- `v` To paste copied notes.
- `4 c` To copy every 4th note.
### Insert Multiple
- `8 as` This will add C5 and D5 to the 1st and 9th note.
### Erase Multiple
- `backspace` To clear a whole column.
- `4 backspace` To clear every 4th bar.
- `42 backspace` To clear every 4th bar, starting at the second bar.
### Modify Multiple
- `+` Increment each note of the pattern.
- `-` Decrement each note of the pattern.
### Use case
To copy the first 16 bars, into the 16 following bars and play the following note.
- `/ F c` Copy the first 16 bars.
- `/ F F v` Paste the first 16 bars from the the 16th bar.
## Loopmode
Press `ctrl l` to activate loopmode.
### Selective play
- `enter` Will play from current sequencer row, for 1 track.
- `/ enter` Will play from current sequencer row, only active instrument, for 1 track.
- `4 enter` Will play from the current sequencer row, for 4 tracks.
- `/ 4 enter` Will play from the current sequencer row, only active instrument, for 4 tracks.
### Copy/Paste
- `c` To copy the selected sequence.
- `v` To **insert** the selected sequence.
## Notes
During render, the track time is displayed in the before-last row of the Editor in the `0252` format, or 2:52.
## Themes
You can customize the look of your tracks by editing the .mar file and replacing the attributes' colors.
```
q CLEAR
w DELETE LAST
e EXPORT(Not working atm, just copy the DOM element)
theme: {
background:"#fff",
f_high:"#f00",
f_med:"#0f0",
f_low:"#00f",
f_inv:"#00f",
b_high:"#ff0",
b_med:"#f0f",
b_low:"#0ff",
b_inv:"#00f"
}
```
## Tools
## Development
```
aA CLOCKWISE
sS COUNTERWISE
d LINE
```
There are currently no means to change the `bpm`, to do so, update the `bpm` value from the exported `.mar` file to an int between 50 and 450. Use `npm start` to develop locally.
## Shapes
### TODOs
```
z DOT
x CIRCLE
c RECT
```
#### Optimisation
- Trim tracks on export.
- Load trimmed track.
#### Feature
- Continuous follow instead of pageview.
- Template file of just sequencer sequences.
#### Misc
- Cancel render with escape.
#### Bug
- add .wav to export(cannot replicate?)
- Clicking icon on dock, shows the application. Replicate on Left.
## License
See the [LICENSE](LICENSE.md) file for license rights and limitations (CC).

6
Updater(OS X).command Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
cd ~/Github/HundredRabbits/Dotgrid/
electron-packager . Dotgrid --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --electron-version=1.7.5 --icon=icon.icns
mv -v ~/Desktop/Dotgrid-darwin-x64/Dotgrid.app /Applications/
rm -r ~/Desktop/Dotgrid-darwin-x64/
open -a "Dotgrid"

BIN
icon.icns Normal file

Binary file not shown.

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

74
main.js Normal file
View File

@ -0,0 +1,74 @@
const {app, BrowserWindow, webFrame, Menu} = require('electron')
const path = require('path')
const url = require('url')
let win
app.on('ready', () =>
{
win = new BrowserWindow({width: 390, height: 420, backgroundColor:"#000", frame:false, resizable:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
win.loadURL(`file://${__dirname}/sources/index.html`)
let is_shown = true;
if (process.platform === 'darwin') {
Menu.setApplicationMenu(Menu.buildFromTemplate([
{
label: 'File',
submenu: [
{ label: 'Quit', accelerator: 'CmdOrCtrl+Q', click: function() { force_quit=true; app.exit(); }}
]
},
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'delete' },
{ role: 'selectall' }
]
},
{
label: 'Window',
submenu : [
{ label: 'Hide', accelerator: 'CmdOrCtrl+H',click: () => { if(is_shown){ win.hide(); } else{ win.show(); }}},
{ label: 'Minimize', accelerator: 'CmdOrCtrl+M',click: () => { win.minimize(); }},
{ label: 'Fullscreen', accelerator: 'CmdOrCtrl+Enter',click: () => { win.setFullScreen(win.isFullScreen() ? false : true); }}
]
}
]));
}
win.on('closed', () => {
win = null
app.quit()
})
win.on('hide',function() {
is_shown = false;
})
win.on('show',function() {
is_shown = true;
})
// Open the DevTools.
// win.webContents.openDevTools()
})
app.on('window-all-closed', () =>
{
app.quit()
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
else{
}
})

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "Dotgrid",
"version": "0.1.0",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^1.7.5",
"electron-prebuilt": "^1.4.13"
},
"dependencies": {
"electron-packager": "^8.4.0"
}
}

27
sources/README.md Normal file
View File

@ -0,0 +1,27 @@
# Dotgrid
Minimalist vector drawing tool to create grid based SVGs. There isn't much to it at the moment. Enjoy!
## Functions
```
q CLEAR
w DELETE LAST
e EXPORT(Not working atm, just copy the DOM element)
```
## Tools
```
aA CLOCKWISE
sS COUNTERWISE
d LINE
```
## Shapes
```
z DOT
x CIRCLE
c RECT
```

View File

@ -12,14 +12,6 @@
<title>Dotgrid(Icon)</title>
</head>
<body>
<pre>
q <b>CLEAR</b>
w <b>DELETE LAST</b>
e <b>EXPORT</b>
aA <b>CLOCKWISE</b>
sS <b>COUNTERWISE</b>
d <b>LINE</b>
</pre>
<script>
dotgrid = new Dotgrid(300,300,30,30,5,5, 10,"square","#000000");
dotgrid.install();

View File

@ -1,4 +1,4 @@
body { background:#fff; padding:50px; font-family: 'input_mono_regular'}
body { background:#fff; padding:30px; font-family: 'input_mono_regular'; -webkit-user-select: none;-webkit-app-region: drag;}
#dotgrid { margin:0px auto; position:relative; border:0px solid white; background:white; overflow: hidden; cursor: none; padding:10px;}
#dotgrid .marker { width:2px; height:2px; background:#ddd; position:absolute; margin-top:-1px; margin-left:-1px; border-radius:4px; z-index:50;}
@ -16,4 +16,10 @@ pre { font-size:11px; color:#000; position:fixed; bottom:20px; display: none}
.settings input { display:inline; background:#fff; width:4em; }
.settings select { display:inline; background:#fff; }
#interface { max-width: 295px;margin:0px auto;font-size: 11px;line-height: 30px; text-transform: uppercase;}
#interface { max-width: 295px;margin:0px auto;font-size: 11px;line-height: 30px; text-transform: uppercase; margin-top:20px;}
.icon { width:25px; height:25px; margin-left:-5px; margin-right:0px; opacity: 0.5}
.icon.right { float:right; opacity: 0.25}
.icon.inactive { opacity: 0.1 !important }
.icon:hover { cursor: pointer; opacity: 1 }

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M50,50 A200,200 0 0,1 250,250 "></path></svg>

After

Width:  |  Height:  |  Size: 286 B

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M50,50 A200,200 0 0,0 250,250 "></path></svg>

After

Width:  |  Height:  |  Size: 286 B

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M50,50 Q50,150 150,150 Q250,150 250,250 "></path></svg>

After

Width:  |  Height:  |  Size: 296 B

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M150,50 A100,100 0 0,1 250,150 A-100,100 0 0,1 150,250 A-100,-100 0 0,1 50,150 "></path></svg>

After

Width:  |  Height:  |  Size: 335 B

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M150,50 L50,150 L150,250 L250,150 L150,50 "></path></svg>

After

Width:  |  Height:  |  Size: 298 B

View File

@ -0,0 +1 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 10px; fill: none; stroke-linecap: square;"><path d="M50,50 L250,250 "></path></svg>

After

Width:  |  Height:  |  Size: 272 B

View File

@ -86,13 +86,23 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
this.svg_el.style.strokeLinecap = this.linecap;
this.element.appendChild(this.svg_el);
this.svg_el.appendChild(this.path);
this.svg_el.appendChild(this.path);
this.draw();
}
// Cursor
this.mouse_down = function(e)
{
var o = e.target.getAttribute("data-operation");
if(!o){ return; }
if(o == "line"){ this.draw_line(); }
if(o == "arc_c"){ this.draw_arc("0,1"); }
if(o == "arc_r"){ this.draw_line("0,0"); }
if(o == "bezier"){ this.draw_line(); }
if(o == "export"){ this.export(); }
}
this.mouse_move = function(e)
@ -110,6 +120,11 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
pos = this.position_on_grid(pos[0],pos[1]);
pos = [pos[0]+10,pos[1]-10]
if(pos[1] > 300){ return; }
if(pos[0] < -300){ return; }
if(pos[0] > 0){ return; }
if(pos[1] < 0){ return; }
if(from === null){ this.set_from(pos); }
else if(to === null){ this.set_to(pos); }
@ -163,7 +178,15 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
{
if(!to && !end){
this.set_from([from[0]+(x*10),from[1]+(y*10)])
this.draw();
return;
}
if(!end){
this.set_to([to[0]+(x*10),to[1]+(y*10)])
this.draw();
return;
}
this.set_end([end[0]+(x*10),end[1]+(y*10)])
this.draw();
}
@ -189,7 +212,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
}
// Draw
this.add_line = function()
this.draw_line = function()
{
if(from === null || to === null){ return; }
@ -297,18 +320,31 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
{
var html = "";
html += "~"+this.thickness+" ";
html += "/"+this.linecap+" ";
if(from && to){
html += "<img data-operation='line' title='line' src='media/icons/line.svg' class='icon'/>";
html += "<img data-operation='arc_c' title='arc clockwise' src='media/icons/arc_clockwise.svg' class='icon'/>";
html += "<img data-operation='arc_r' title='arc reverse' src='media/icons/arc_reverse.svg' class='icon'/>";
}
else{
html += "<img title='line' src='media/icons/line.svg' class='icon inactive'/>";
html += "<img title='arc clockwise' src='media/icons/arc_clockwise.svg' class='icon inactive'/>";
html += "<img title='arc reverse' src='media/icons/arc_reverse.svg' class='icon inactive'/>";
}
if(from){ html += ">" }
if(to){ html += ">" }
if(end){ html += ">" }
html += " "
if(to){ html += "aA sS d f" }
if(end){ html += ">" }
if(from && to && end){
html += "<img data-operation='bezier' title='bezier' src='media/icons/bezier.svg' class='icon'/>";
}
else{
html += "<img title='bezier' src='media/icons/bezier.svg' class='icon inactive'/>";
}
if(this.segments.length > 0){
html += "<img data-operation='export' title='export' src='media/icons/export.svg' class='icon right'/>";
}
else{
html += "<img title='export' src='media/icons/export.svg' class='icon right inactive'/>";
}
this.interface.innerHTML = html;
}

View File

@ -6,7 +6,7 @@ function Keyboard()
switch (event.keyCode) {
case 65 : dotgrid.draw_arc(event.shiftKey ? "1,1" : "0,1"); break;
case 83 : dotgrid.draw_arc(event.shiftKey ? "1,0" : "0,0"); break;
case 68 : dotgrid.add_line(); break;
case 68 : dotgrid.draw_line(); break;
case 70 : dotgrid.draw_bezier(); break;
case 187 : dotgrid.mod_thickness(1); break;
case 189 : dotgrid.mod_thickness(-1); break;